#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int arr[MAXN];
int main() {
  int N, ans = 0;
  cin >> N;
  for (int i = 0; i < N; i++) cin >> arr[i];
  sort(arr, arr + N);
  for (int i = 0, j = 1; i < N; i++) {
    while (arr[i] >= arr[j] && j <= N - 1) j++;
    if (j == N) break;
    ans++;
    j++;
  }
  cout << ans << endl;
  return 0;
}
