#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, c, s = 0, d = 0;
  cin >> n;
  long long a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  c = a[0];
  d = 0;
  for (i = 1; i < n; i++) {
    c = a[d];
    if (a[i] != c) {
      s++;
      d++;
    }
  }
  cout << d << endl;
}
