#include <bits/stdc++.h>
using namespace std;
int a[1010], b[1010];
bool vis[1010];
int main() {
  int n, i, ans, nn, lb;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  memset(vis, false, sizeof(vis));
  ans = 0;
  nn = 0;
  while (1) {
    lb = 0;
    b[0] = 0;
    for (i = 1; i <= n; i++)
      if (vis[i] == false && a[i] > b[lb]) {
        b[++lb] = a[i];
        vis[i] = true;
        nn++;
      }
    ans += (lb - 1);
    if (nn == n) break;
  }
  printf("%d", ans);
  return 0;
}
