#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int n, ans = -1;
int main() {
  cin >> n;
  int x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    mp[x]++;
    ans = max(ans, mp[x]);
  }
  cout << n - ans;
}
