#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  int c[1005] = {0};
  int u[1005] = {0}, t = 0;
  for (int i = 0; i < n; i++) {
    if (c[arr[i]] == 0) {
      u[t++] = arr[i];
    }
    c[arr[i]]++;
  }
  int fans = 0;
  while (1) {
    int ans = -1;
    for (int i = 0; i < t; i++) {
      if (c[u[i]] > 0) {
        ans++;
        c[u[i]]--;
      }
    }
    if (ans <= 0) break;
    fans += ans;
  }
  cout << fans;
}
