#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, s = 0;
  map<int, int> a;
  a.clear();
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &m);
    a[m]++;
  }
  while (1) {
    int y = 0;
    if (n == 0) break;
    map<int, int>::iterator it;
    for (it = a.begin(); it != a.end(); it++) {
      if (it->second == 0) {
        continue;
      }
      it->second--;
      y++;
      n--;
    }
    s += y - 1;
  }
  cout << s << endl;
  return 0;
}
