#include <bits/stdc++.h>
int in[1000];
int cmp(const void *a, const void *b) { return *(int *)a - *(int *)b; }
int main() {
  int n, i, j, max = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", in + i);
  qsort(in, n, sizeof(int), cmp);
  for (i = 0; i < n; i = j) {
    for (j = i + 1; j < n && in[j] == in[i]; j++)
      ;
    if (max < j - i) max = j - i;
  }
  printf("%d\n", n - max);
  return 0;
}
