#include <bits/stdc++.h>
using namespace std;
inline int myrand(int l, int r) {
  int ret = rand();
  ret <<= 15;
  ret ^= rand();
  if (ret < 0) ret = -ret;
  ret %= (r - l + 1);
  ret += l;
  return ret;
}
template <typename F, typename S>
ostream& operator<<(ostream& os, const pair<F, S>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
int n;
map<int, int> mp;
int32_t main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    mp[x]++;
  }
  int took = 0, have = 0;
  for (map<int, int>::iterator it = mp.begin(); it != mp.end(); it++) {
    int k = it->second;
    int now = min(have - took, k);
    took += now, have += k;
  }
  cout << took << '\n';
}
