#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  int i = n - 1, j = n - 1, ans = 0;
  while (j >= 0) {
    while (j >= 0 && a[--j] == a[i]) continue;
    ans += j >= 0;
    --i;
  }
  cout << ans << '\n';
}
