#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  vector<int> b;
  int last = 0, res = 0;
  while (a.size() > 0) {
    auto mn = a.end() - 1;
    for (auto it = a.begin(); it != a.end(); ++it) {
      if (*it > last && (*it < *mn)) {
        mn = it;
      }
    }
    if (*mn <= last) mn = a.begin();
    b.push_back(*mn);
    last = *mn;
    a.erase(mn);
  }
  for (size_t i = 0; i < b.size() - 1; ++i) {
    if (b[i + 1] > b[i]) ++res;
  }
  cout << res << endl;
  return 0;
}
