#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, i, c[1005] = {0}, d, f = 0, t1 = 0, t2 = 0;
  cin >> a;
  for (i = 0; i < a; i++) {
    cin >> d;
    c[d]++;
  }
  for (;;) {
    if (f == 1) break;
    f = 1;
    t1++;
    for (i = 0; i < 1005; i++) {
      if (c[i] > 0) {
        t2++;
        c[i]--;
        if (c[i] > 0) f = 0;
      }
    }
  }
  cout << t2 - t1;
  return 0;
}
