#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int cnt = 0;
  for (int i = n - 1, j = n - 2; j >= 0; j--, i--) {
    bool x = 1;
    for (; j >= 0; j--) {
      if (a[i] > a[j]) {
        cnt++;
        x = 0;
        break;
      }
    }
    if (x) break;
  }
  cout << cnt << endl;
  return 0;
}
