#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 7, inf = 1e9 + 7, mod = 1e9 + 7;
int n, a[maxn], b[maxn], d[maxn], ans;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a, a + n);
  for (int j = 0; j < n; ++j) {
    ++d[a[j]];
    ++b[d[a[j]]];
  }
  for (int i = 0; i < maxn; ++i) {
    ans += max(b[i] - 1, 0);
  }
  printf("%d", ans);
  return 0;
}
