#include <bits/stdc++.h>
int n, a, b, c[1009];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a);
    if (b < ++c[a]) b = c[a];
  }
  printf("%d\n", n - b);
  return 0;
}
