#include <bits/stdc++.h>
using namespace std;
int main() {
  int hsh[1005] = {0};
  int n, i, j, cnt, k = 0, ans = 0;
  scanf("%d", &n);
  for (i = 0; i <= n - 1; i++) {
    scanf("%d", &j);
    hsh[j]++;
  }
  cnt = 1;
  while (cnt > 0) {
    cnt = -1;
    for (i = 0; i <= 1001; i++) {
      if (hsh[i] > 0) {
        hsh[i]--;
        cnt++;
      }
    }
    if (cnt == -1 || cnt == 0) break;
    ans += cnt;
  }
  printf("%d", ans);
  printf("\n");
  return 0;
}
