#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
const int N = 1010;
map<int, int> m;
int n, x, M;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    m[x]++;
    M = max(m[x], M);
  }
  cout << n - M;
}
