#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int T; cin >> T; rep(_,T) { int N; cin >> N; map mp; rep(i,N) { int L; cin >> L; mp[L]++; } priority_queue pq; for(auto [_, c] : mp) pq.push(c); int ans = 0; while(int(pq.size()) >= 3) { int a = pq.top(); pq.pop(); int b = pq.top(); pq.pop(); int c = pq.top(); pq.pop(); a--; b--; c--; ans++; if(a > 0) pq.push(a); if(b > 0) pq.push(b); if(c > 0) pq.push(c); } cout << ans << "\n"; } }