#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, int> mp;
  int a, b, mx = 0, cnt = 0, n;
  vector<int> v;
  cin >> a;
  for (int i = 0; i < a; i++) {
    cin >> b;
    v.push_back(b);
    mp[b]++;
    if (mp[b] > mx) {
      mx = mp[b];
      n = b;
    }
  }
  for (int i = 0; i < a; i++) {
    if (v[i] != n) {
      cnt++;
    }
  }
  cout << cnt;
}
