#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, p = 0, q = 0, r = 0, s = 0, t = 0, z = 0;
  cin >> n;
  int a[n], c[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < i; j++) {
      if (a[i] != a[j])
        p++;
      else
        j = i - 1;
    }
    if (p == i) {
      for (j = i; j < n; j++) {
        if (a[i] == a[j]) q++;
      }
      c[t] = q;
      t++;
      q = 0;
    }
    p = 0;
  }
  while (r == 0) {
    for (i = 0; i < t; i++) {
      if (c[i] > 0) {
        s++;
        c[i] = c[i] - 1;
      }
    }
    if (s <= 1)
      r = 1;
    else
      z = z + s - 1;
    s = 0;
  }
  cout << z;
  return 0;
}
