#include <bits/stdc++.h>
using namespace std;
string s;
bool check(long long int pos) {
  if (s[pos] == 'a' || s[pos] == 'e' || s[pos] == 'i' || s[pos] == 'o' ||
      s[pos] == 'u' || s[pos] == 'n') {
    return true;
  }
  return false;
}
bool check1(long long int pos) {
  if (s[pos] == 'a' || s[pos] == 'e' || s[pos] == 'i' || s[pos] == 'o' ||
      s[pos] == 'u') {
    return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int n;
  cin >> n;
  long long int i, j, k, a[n + 1];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  j = 0;
  long long int cnt = 0;
  for (i = 0; i < n; i++) {
    long long int pos = upper_bound(a + j, a + n, a[i]) - (a + j);
    j = j + pos;
    if (j < n) {
      cnt++;
    }
    j++;
    if (j >= n) {
      break;
    }
  }
  cout << cnt << "\n";
  return 0;
}
