#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int cnt[1005];
  vector<int> construct;
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    cnt[temp]++;
  }
  int rem = n;
  while (rem) {
    for (int i = 1; i < 1005; i++) {
      if (cnt[i]) {
        cnt[i]--;
        construct.push_back(i);
        rem--;
      }
    }
  }
  int ans = 0;
  for (int i = 1; i < n; i++) {
    if (construct[i] > construct[i - 1]) ans++;
  }
  cout << ans << endl;
}
