#include <bits/stdc++.h>
using namespace std;
long long in[100005];
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) cin >> in[i];
  if (N >= 2) sort(in, in + N, less<long long>());
  int fast = 1, now = 0;
  int ans = 0;
  while (fast < N) {
    while (fast < N && in[fast] == in[now]) fast++;
    if (in[fast] > in[now]) {
      ans++;
      fast++;
      now++;
    }
  }
  printf("%d\n", ans);
}
