#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, int> mp;
  int n, x, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x, mp[x]++;
  do {
    x = 0;
    for (int i = 1; i < 1001; i++)
      if (mp[i]) {
        x++;
        mp[i]--;
      }
    if (x > 1) ans += x - 1;
  } while (x > 1);
  cout << ans;
}
