func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long int t, x, sum = 0, y, z, flag = 0, a, p, l, r, b, c, q, i, j, k, n,                         m, maxi = LONG_MIN, mini = LONG_MAX, mul = 1;     string s, s1;     vector<long long int> v, va, vb;     map<long long int, long long int> mp, mp1;     cin >> n;     for (i = 0; i < n; i++) {       cin >> x;       mp[x]++;       mp1[x]++;     }     auto it = mp.begin();     auto it1 = mp1.begin();     while (it1 != mp1.end()) {       if (it->first == it1->first) it1++;       if (it1 == mp1.end()) break;       x = it->second;       y = it1->second;       for (i = 0; i < x && i < y; i++) {         mp[it->first]--;         sum++;         mp1[it1->first]--;       }       if (x == i) it++;       if (y == i) it1++;     }     cout << sum << endl;   }   