#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> vec;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    vec.push_back(a);
  }
  sort(vec.begin(), vec.end());
  int pointer = 0;
  int count = 0;
  for (int i = 0; i < n; i++) {
    int flag = 0;
    while (pointer < n) {
      if (vec[i] < vec[pointer]) {
        flag = 1;
        break;
      }
      pointer++;
    }
    pointer++;
    if (flag == 1) count++;
  }
  cout << count << endl;
}
