fork download
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. int n ; cin>>n;
  7. vector<int>arr(n);
  8. unordered_map<int,int>hash;
  9. for(int i = 0 ; i<n;i++){
  10. hash[arr[i]]++;
  11. }
  12. int maxfreq = 0;
  13. for(auto p: hash){
  14. if(p.second>maxfreq){
  15. maxfreq = p.second;
  16. }
  17. }
  18. cout<<n-maxfreq;
  19. // your code goes here
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5284KB
stdin
11
5 5 5 6 6 6 6 1 1 1 2 
stdout
Standard output is empty