#include <bits/stdc++.h>
using namespace std;
int i, n, a[100005], p, ans = 0;
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  sort(a, a + n);
  for (i = 0, p = 0; i < n && p < n; i++) {
    while (a[p] <= a[i]) {
      p++;
      if (p == n) {
        cout << ans;
        return 0;
      }
    }
    ans++;
    p++;
  }
  cout << ans;
  return 0;
}
