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