fork download
  1. #include <iostream>
  2. #include <array>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int d;
  9. cin >> d;
  10.  
  11. unsigned short int sticks[256];
  12.  
  13. fill(sticks, sticks+256, 0);
  14.  
  15. while(d--)
  16. {
  17. unsigned short length;
  18. cin >> length;
  19.  
  20. sticks[length]++;
  21. }
  22.  
  23. int sum=0;
  24.  
  25. for(int i=0; i<256; i++)
  26. {
  27. sum+=sticks[i]/3;
  28. }
  29.  
  30. cout << sum << endl;
  31.  
  32. return 0;
  33. }
  34.  
Success #stdin #stdout 0.01s 5540KB
stdin
Standard input is empty
stdout
0