#include <bits/stdc++.h>
using namespace std;
long long k, k1, n, n2, k3, l, a[1005];
bool f;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  l = 1;
  f = 0;
  while (a[n - 1]) {
    k1 = 0;
    for (int i = l; i < n; i++)
      if (a[i - 1] < a[i]) k++, k1++, a[i - 1] = 0;
    a[n - 1] = 0;
    k1++;
    sort(a + l - 1, a + n);
    l += k1;
  }
  cout << k;
}
