#include <bits/stdc++.h>
using namespace std;
int n;
int A[100005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> A[i];
  map<int, int> M;
  for (int i = 0; i < n; i++) M[A[i]]++;
  map<int, int>::iterator it;
  int cnt = 0;
  int ans = 0;
  for (it = M.begin(); it != M.end();) {
    cnt += (*it).second;
    it++;
    if (it == M.end()) break;
    int tmp = min(cnt, (*it).second);
    cnt -= tmp;
    ans += tmp;
  }
  cout << ans;
  return 0;
}
