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