#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> v;
vector<pair<int, int> > v1;
void init() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  v.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
}
void solve() {
  int cur = v[0];
  for (int i = 0; i < v.size();) {
    cur = v[i];
    v1.push_back(make_pair(cur, 0));
    while (cur == v[i]) {
      i++;
      v1.back().second++;
    }
  }
  int ans = 0;
  for (int k = 0; k < 1001; ++k) {
    int cnt = 0;
    for (int i = 0; i < v1.size(); ++i) {
      if (v1[i].second != 0) {
        cnt++;
        v1[i].second--;
      }
    }
    if (cnt != 0) {
      ans += cnt - 1;
    }
  }
  cout << ans;
}
int main() {
  init();
  solve();
  return 0;
}
