#include <bits/stdc++.h>
int main() {
  int n;
  std::cin >> n;
  std::vector<int> xs(n);
  for (int& x : xs) std::cin >> x;
  std::sort(xs.begin(), xs.end());
  int c = 0;
  for (;;) {
    int i = 0;
    while (i < n && !xs[i]) ++i;
    if (!xs[i]) break;
    for (int j = i + 1; j < n; ++j) {
      if (xs[j] > xs[i]) {
        xs[i] = 0;
        ++c;
        i = j;
      }
    }
    xs[i] = 0;
  }
  std::cout << c << '\n';
}
