#include <bits/stdc++.h>
using namespace std;
const int MAX = 5e5 + 10, mod = 1e9 + 9, base = 41, INF = 1e9 + 10, sq = 502;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  long long n;
  cin >> n;
  map<int, int> mp;
  for (long long i = 0; i < (n); ++i) {
    long long a;
    cin >> a;
    mp[a]++;
  }
  int max = 0, ans = 0;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    if (it->second > max) {
      max = it->second;
    }
  }
  while (max--) {
    long long count = -1;
    for (auto it = mp.begin(); it != mp.end(); it++) {
      if (it->second != 0) {
        count++;
        it->second--;
      }
    }
    ans += count;
  }
  cout << ans << endl;
  return 0;
}
