#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[1010], i, j, b[1010], flg, flag, ans;
  while (cin >> n) {
    int max = 0;
    for (i = 0; i < 1010; i++) {
      a[i] = b[i] = 0;
    }
    ans = 0;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      b[a[i]]++;
      if (b[a[i]] > 1) flg++;
      if (b[a[i]] > max) max = b[a[i]];
    }
    cout << n - max << endl;
  }
  return 0;
}
