#include <bits/stdc++.h>
using namespace std;
int arr[100100];
int freqs[100100];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n;
  cin >> n;
  for (int i = 0; i < (int)(n); i++) cin >> arr[i];
  sort(arr, arr + n);
  int prev = arr[0];
  int cnt = 1;
  int index = 0;
  for (int i = 1; i <= (int)(n - 1); i++) {
    if (arr[i] == prev) {
      cnt++;
    } else {
      freqs[index] = cnt;
      cnt = 1;
      index++;
      prev = arr[i];
    }
  }
  freqs[index] = cnt;
  int ans = freqs[0];
  int spots = freqs[0];
  for (int i = 1; i <= (int)(index); i++) {
    if (spots >= freqs[i]) {
      spots -= freqs[i];
    } else {
      ans += freqs[i] - spots;
      spots = 0;
    }
    spots += freqs[i];
  }
  cout << n - ans << endl;
}
