#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[1000] = {0}, b, c, d, i, j, m;
  cin >> m;
  c = 0;
  for (i = 0; i < m; i++) {
    cin >> b;
    a[b]++;
    if (c < b) {
      c = b;
    }
  }
  b = 0;
  d = 0;
  for (i = 1; i <= c; i++) {
    b = b + a[i];
    if (d < a[i]) {
      d = a[i];
    }
  }
  cout << b - d << endl;
  return 0;
}
