#include <bits/stdc++.h>
bool cmp(int a, int b) { return a > b; }
using namespace std;
int main() {
  long long n, a[100005], sum = 0;
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  sort(a + 1, a + n + 1, cmp);
  int l = 1;
  for (int j = 2; j <= n; ++j) {
    if (a[l] > a[j]) {
      sum++;
      l++;
    }
  }
  cout << sum;
  return 0;
}
