fork(104) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.  
  7. int n, i, x, y, ans = 0;
  8.  
  9. cin >> n;
  10. map<int, int> mm;
  11. vector<int> a(n, 0);
  12.  
  13. for (i = 0; i < n; i++)
  14. {
  15. cin >> a[i];
  16. mm[a[i]]++;
  17. }
  18. for (auto p : mm)
  19. {
  20. y = p.second;
  21.  
  22. ans += (y / 2);
  23. }
  24.  
  25. cout << ans << endl;
  26. }
Success #stdin #stdout 0.01s 5540KB
stdin
8
1 2 1 1 1 1 1 1
stdout
3