#include <bits/stdc++.h>
using namespace std;
int arr[100005];
int n;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  sort(arr + 1, arr + n + 1);
  int now = 1;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (arr[i] > arr[now]) {
      ans++;
      now++;
    }
  }
  cout << ans << "\n";
}
