#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int arr[n];
  int mp[1005] = {0};
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
    mp[arr[i]]++;
  }
  int ans = 0;
  vector<int> v;
  for (int i = 1; i <= 1000; i++) {
    if (mp[i]) {
      while (mp[i] > 0) {
        v.push_back(i);
        mp[i]--;
        for (int j = i + 1; j <= 1000; j++) {
          if (mp[j]) {
            mp[j]--;
            v.push_back(j);
          }
        }
      }
    }
  }
  int len = v.size();
  for (int i = 0; i < len - 1; i++) {
    if (v[i + 1] > v[i]) ans++;
  }
  printf("%d\n", ans);
}
