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