#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, int> scores;
  for (int i = 1; i < 1000 + 1; i++) {
    scores[i] = 0;
  }
  int tmp;
  for (int i; i < n; i++) {
    cin >> tmp;
    scores[tmp] += 1;
  }
  int result = 0;
  while (1) {
    int min_val = 1001;
    for (int i = 1; i <= 1000; i++)
      if (scores[i] != 0) min_val = min(scores[i], min_val);
    if (min_val == 1001) break;
    for (int i = 1; i <= 1000; i++) {
      if (scores[i] != 0) {
        scores[i] -= min_val;
        result += min_val;
      }
    }
    result -= min_val;
  }
  cout << result;
  return 0;
}
