#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> nums(1001);
  int maximum = 0;
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    nums[num]++;
    maximum = max(maximum, nums[num]);
  }
  cout << n - maximum << "\n";
}
