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