#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const long long infLL = 9000000000000000000;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  map<int, int> cnt;
  while (n--) {
    int x;
    cin >> x;
    cnt[x]++;
  }
  vector<int> v;
  for (auto u : cnt) v.push_back(u.second);
  sort((v).begin(), (v).end());
  v.pop_back();
  cout << accumulate((v).begin(), (v).end(), 0) << '\n';
  return 0;
}
