#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     int n, val;     cin >> n;     vector<int> vet;     for (int i = 0; i < n; i++) {       cin >> val;       vet.push_back(val);     }     sort(vet.begin(), vet.end());     vector<int> ans;     while (ans.size() < n) {       set<int> opa;       for (int i = 0; i < n; i++) {         if (vet[i] != -1) opa.insert(vet[i]);       }       set<int>::iterator it = opa.begin();       while (it != opa.end()) {         ans.push_back(*it);         it++;       }       for (int i = 0; i < n; i++) {         if (opa.count(vet[i])) {           opa.erase(vet[i]);           vet[i] = -1;         }       }     }     int resp = 0;     for (int i = 0; i < n - 1; i++) {       if (ans[i + 1] > ans[i]) resp++;     }     cout << resp <<   n ;     return 0;   }   