#include <bits/stdc++.h>
using namespace std;
const int64_t INF = 0x7FFFFFFF;
const int MAX = 1;
unordered_map<int, int> maps;
unordered_map<int, int> cnt;
int main(int argc, char* args[]) {
  int n;
  scanf("%d", &n);
  for (int(i) = (0), _n = (n - 1); (i) <= _n; (i)++) {
    int x;
    scanf("%d", &x);
    maps[x]++;
  }
  for (auto it : maps) {
    int x = it.second;
    for (int(i) = (1), _n = (x); (i) <= _n; (i)++) {
      cnt[i]++;
    }
  }
  int ans = 0;
  for (auto it : cnt) {
    ans += it.second - 1;
  }
  printf("%d\n", ans);
  return 0;
}
