#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, ans, tot;
int a[maxn], b[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  for (int i = 1, j; i <= n; ++i) {
    j = upper_bound(a + 1, a + 1 + n, a[i]) - a - 1;
    b[++tot] = j - i + 1;
    i = j;
  }
  int emp = 0;
  for (int i = 1; i <= tot; ++i) {
    ans += min(emp, b[i]);
    emp = max(emp, b[i]);
  }
  printf("%d\n", ans);
  return 0;
}
