#include <bits/stdc++.h>
using namespace std;
const int MAX = 1005;
int maxInArray(const vector<int>& array) {
  int answer = array[0];
  for (size_t i = 0; i < array.size(); ++i) {
    if (array[i] > answer) {
      answer = array[i];
    }
  }
  return answer;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> countNumbers(MAX);
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    ++countNumbers[x];
  }
  int maxEq = maxInArray(countNumbers);
  cout << n - maxEq << endl;
  return 0;
}
