#include <bits/stdc++.h>
using namespace std;
int main() {
  int last;
  int a[1001], n;
  scanf("%d", &n);
  int visitcnt = 0;
  bool visited[1001];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    visited[i] = false;
  }
  sort(a, a + n);
  int res = 0;
  while (visitcnt < n) {
    last = -1;
    for (int i = 0; i < n; i++) {
      if (a[i] > last && visited[i] == false) {
        visited[i] = true;
        if (last != -1) res++;
        visitcnt++;
        last = a[i];
      }
    }
  }
  printf("%d\n", res);
  return 0;
}
