#include <bits/stdc++.h>
using namespace std;
int x[100010], n;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    cin >> x[i];
    m[x[i]]++;
  }
  map<int, int>::iterator i = m.end();
  int cnt = 0, ans = 0;
  for (i--; i != m.begin(); i--) {
    if (cnt >= i->second) {
      ans += i->second;
    } else {
      ans += cnt;
      cnt = i->second;
    }
  }
  if (cnt >= i->second) {
    ans += i->second;
  } else {
    ans += cnt;
    cnt = i->second;
  }
  cout << ans;
  return 0;
}
