#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
inline void print(int x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
bool cmp(int a, int b) { return a > b; }
int n, a[100005], l = 1, s;
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  sort(a + 1, a + 1 + n, cmp);
  for (int i = 2; i <= n; ++i)
    if (a[l] > a[i]) s++, l++;
  print(s);
}
