func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   const long long N = 1e6 + 5;   long long solve() {     long long n;     cin >> n;     map<long long, long long> mp;     vector<long long> v(n);     for (long long &x : v) {       cin >> x;       mp[x]++;     }     long long ans = 0;     for (auto it : mp) {       long long usable = (long long)mp.size() - 1;       long long use = min(usable, it.second);       if (it.second > usable + 1) {         ++use;       }       ans = max(ans, use);     }     cout << ans <<   n ;     return 0;   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     cout.tie(NULL);     long long T = 1;     cin >> T;     for (long long i = 1; i <= T; ++i) solve();     return 0;   }   