fork(1) download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int colors[9]; // массив, содержащий кол-во шариков определенного цвета
  5. int main() {
  6. int temp;
  7. int n;
  8. int maximum=0;
  9. cin >> n;
  10. for(int i = 0; i < n; i++){
  11. cin >> temp;
  12. colors[temp-1]++;
  13. if(colors[temp-1] > maximum) maximum = colors[temp-1];
  14. }
  15. cout << n-maximum;
  16. return 0;
  17. }
Success #stdin #stdout 0s 15232KB
stdin
3
1 2 3
stdout
2