#include <bits/stdc++.h>
using namespace std;
int a[100005];
signed main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int pointer = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    int j;
    for (j = pointer; j < n; j++) {
      if (a[j] > a[i]) break;
    }
    if (j == n)
      break;
    else {
      ans++;
      pointer = j + 1;
    }
  }
  cout << ans;
}
