#include <bits/stdc++.h>
using namespace std;
int n;
queue<int> q;
int solve() {
  int ans = 0;
  while (q.size() > 0) {
    set<int> s;
    queue<int> new_q;
    while (q.size() > 0) {
      int val = q.front();
      q.pop();
      if (s.size() == 0) {
        s.insert(val);
      } else {
        if (s.find(val) == s.end()) {
          s.insert(val);
          ans++;
        } else {
          new_q.push(val);
        }
      }
    }
    q = new_q;
  }
  return ans;
}
int main(int argc, const char* argv[]) {
  scanf("%d", &n);
  int tmp;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &tmp);
    q.push(tmp);
  }
  int ans = solve();
  printf("%d", ans);
  return 0;
}
