aboutsummaryrefslogtreecommitdiff
path: root/codeforces/Equalize_the_array/Equalize_the_array.cpp
blob: 89af0d8a493c289c28772a06ff6ebe3bcc9861bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include<bits/stdc++.h>

using namespace std;

int main(){
  int n, x;
  cin >> n;
  map<int, int> mp;
  vector<int> freq;
  for(int i =0; i < n; i++){
    cin >> x;
    mp[x]++;
  }
  for(auto x : mp){
    freq.push_back(x.second);
  }
  cout << n - *max_element(freq.begin(), freq.end()) << '\n';
  return 0;
}