#include <bits/stdc++.h>
using namespace std;
int n, ans, a[100005], k, d;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    if (a[k] <= a[i])
      while (a[k] <= a[i] && k < n) k++;
    else
      k++;
    if (k < n) d++;
  }
  cout << d << endl;
  return 0;
}
