fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a[] = {1, 2, 3, 4};
  6. int n = 4;
  7.  
  8. int freq[100] = {0};
  9.  
  10. for(int i = 0; i < n; i++) {
  11. freq[a[i]]++;
  12. }
  13.  
  14. int max = 0;
  15. for(int i = 0; i < 100; i++) {
  16. if(freq[i] > max) {
  17. max = freq[i];
  18. }
  19. }
  20.  
  21. int operations = n - max;
  22. cout << operations << endl;
  23.  
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0.01s 5312KB
stdin
Standard input is empty
stdout
3