#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> v(n);
  for (auto &x : v) {
    scanf("%d", &x);
  }
  sort(v.begin(), v.end());
  int pos = 0, cnt = 0;
  for (int x : v) {
    while (pos < n) {
      if (v[pos] > x) {
        pos++;
        cnt++;
        break;
      }
      pos++;
    }
  }
  printf("%d\n", cnt);
  return 1 == 0;
}
