#include <bits/stdc++.h>
using namespace std;
int p[100001];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> p[i];
  sort(p, p + n);
  int cnt = 0;
  int result = 0;
  for (int i = 0; i < n; i++) {
    if (cnt > n - 1) {
      cout << result << endl;
      return 0;
    }
    while (p[cnt] <= p[i]) {
      if (cnt >= n - 1) {
        cout << result << endl;
        return 0;
      }
      cnt++;
    }
    result++;
    cnt++;
  }
  cout << result << endl;
}
