fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int n;
  6. cin>>n;
  7. vector<int> arr(n);
  8. unordered_map<int,int> mp;
  9. for(auto &i: arr)
  10. {
  11. cin>>i;
  12. mp[i]++;
  13. }
  14. int max=0;
  15. for(auto p: mp)
  16. {
  17. if(p.second>max)
  18. {
  19. max=p.second;
  20. }
  21. }
  22. cout<<n-max;
  23. }
  24.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
Standard output is empty