#include <bits/stdc++.h>
using namespace std;
const unsigned int q = 1e9;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n, l, m, t, w = 0, c, x, ans = 0, y, pre = 1e5, mid, cnt = 0,
                            now, r = 0, k, a[1009] = {0}, h[1009] = {0}, i = 0,
                            j = 0, flag = 0, temp = 0, e = -1e4, o = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> w;
    h[w]++;
  }
  cnt = 0;
  for (i = 0; i <= 1000; i++) {
    if (h[i] == 0) continue;
    ans = ans + min(h[i], cnt);
    if (h[i] - cnt > 0) cnt = cnt + (h[i] - cnt);
  }
  cout << ans;
  return 0;
}
