#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> alist;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    alist.push_back(a);
  }
  sort(alist.begin(), alist.end());
  vector<int> newlist;
  newlist = alist;
  int count = 0;
  while (true) {
    newlist.clear();
    int before = alist[0];
    int chk = 0;
    for (auto x : alist) {
      if (chk == 0) {
        chk = 1;
        continue;
      }
      if (x != before) count += 1;
      if (x == before) newlist.push_back(x);
      before = x;
    }
    alist = newlist;
    if (newlist.size() == 0) break;
  }
  cout << count << endl;
}
