#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
int n;
int cnt[maxn];
int main() {
  scanf("%d", &n);
  int cut = 0;
  for (register int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    cnt[a]++;
    cut = max(cut, cnt[a]);
  }
  printf("%d\n", n - 1 - cut + 1);
  return 0;
}
