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