#include <bits/stdc++.h>
using namespace std;
int n;
int a[100005];
bool isunavailable[100005];
int ans = 0;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    int pos = upper_bound(a + 1, a + n + 1, a[i]) - a;
    for (; pos <= n && isunavailable[pos]; pos++)
      ;
    if (pos == n + 1) break;
    isunavailable[pos] = true;
    ans++;
  }
  cout << ans << '\n';
  return 0;
}
