#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[10000] = {0};
  int mxx = 0;
  int b[n];
  int minn = 2000;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    a[b[i]]++;
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int f = 0;
    for (int j = 0; j < 1001; j++) {
      if (a[j]) {
        if (f) sum++;
        f = 1;
        a[j]--;
      }
    }
  }
  cout << sum;
  return 0;
}
