#include <bits/stdc++.h>
using namespace std;
int INF = 2147483647;
int inf = -2147483648;
int dis[1005];
int main() {
  int n;
  int a;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    dis[a]++;
  }
  for (int i = 0; i <= 1000; i++) {
    inf = max(inf, dis[i]);
  }
  cout << (n - inf) << endl;
  ;
  return 0;
}
