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