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