#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int maxn = 1e5 + 5;
const double pi = acos(-1);
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const long long oo = 1e18;
const int N = 2e3 + 5;
void myMain() {
  int n;
  cin >> n;
  set<int> s;
  map<int, int> frq;
  for (int i = 0, x; i < n; i++) {
    cin >> x;
    frq[x]++;
    s.insert(x);
  }
  vector<int> a;
  while ((int)(a.size()) < n) {
    for (auto i : s)
      if (frq[i]) {
        a.push_back(i);
        frq[i]--;
      }
  }
  int cnt = 0;
  for (int i = 1; i < n; i++)
    if (a[i] > a[i - 1]) cnt++;
  cout << cnt << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  int t = 1;
  while (t--) {
    myMain();
  }
}
