#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d, n, i, j;
string s;
map<long long, long long> m;
map<long long, long long>::iterator ii;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a;
    m[a]++;
  }
  while (m.size() != 0) {
    long long k = 0;
    for (ii = m.begin(); ii != m.end();) {
      k++;
      (ii->second)--;
      if (ii->second == 0)
        m.erase(ii++);
      else
        ii++;
    }
    d += (k - 1);
  }
  cout << d << endl;
}
