#include <bits/stdc++.h>
using namespace std;
constexpr int UNDEF = -1;
class Application {
 public:
  inline void Run();

 private:
  inline void LoadData();
  inline void Solve();
  int size_;
  map<int, int> M;
};
int main() {
  ios_base::sync_with_stdio(false);
  Application app;
  app.Run();
}
inline void Application::LoadData() {
  cin >> size_;
  int a;
  for (unsigned int i = 0; i < (size_); i++) {
    cin >> a;
    if (M.count(a) > 0)
      M[a] = M[a] + 1;
    else
      M[a] = 1;
  }
}
inline void Application::Solve() {
  int res = 0;
  bool last;
  while (true) {
    last = false;
    for (auto it : M) {
      if (it.second > 0) {
        if (last) ++res;
        last = true;
      }
      M[it.first] = M[it.first] - 1;
    }
    if (!last) break;
  }
  cout << res << "\n";
}
inline void Application::Run() {
  LoadData();
  Solve();
}
