#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000;
int x[MAX_N];
void rec(int y, int x, int a[]) {
  int i = y, j = x, c = a[(x + y) / 2], s;
  while (i <= j) {
    for (i; a[i] < c; i++)
      ;
    for (j; a[j] > c; j--)
      ;
    if (i <= j) {
      s = a[i];
      a[i] = a[j];
      a[j] = s;
      j--;
      i++;
    }
  }
  if (j > y) rec(y, j, a);
  if (i < x) rec(i, x, a);
}
int main() {
  int n, a, t = 0;
  cin >> n;
  for (int i = 0; i < MAX_N; i++) {
    x[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    cin >> a;
    a--;
    x[a]++;
  }
  a = 0;
  do {
    a = 0;
    for (int i = 0; i < MAX_N; i++) {
      if (x[i] > 0) {
        x[i]--;
        a++;
      }
    }
    if (a > 1) t += a - 1;
  } while (a > 1);
  cout << t;
  return 0;
}
