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