#include <bits/stdc++.h>
using namespace std;
const long long int maxN = 1E3 + 10;
const long long int mod = 1E9 + 7;
const long long int INF = 1E9;
long long int cnt[maxN];
int32_t main() {
  long long int n;
  cin >> n;
  for (long long int i = 0; i < n; ++i) {
    long long int x;
    cin >> x;
    cnt[x]++;
  }
  long long int otp = 0;
  for (long long int i = 0; i < maxN; ++i) {
    vector<long long int> v;
    for (long long int j = 0; j < maxN; ++j)
      if (cnt[j] >= 1) {
        v.push_back(j);
        cnt[j]--;
      }
    if (v.size() == 0) continue;
    otp += v.size() - 1;
  }
  cout << otp << endl;
  return 0;
}
