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