from bisect import bisect_right T = int(input()) for _ in range(T): N = int(input()) L = sorted(list(map(int,input().split()))) ans = 0 while L: A = [] A.append(L.pop(0)) ind = bisect_right(L,A[-1]) if ind==len(L):break A.append(L.pop(ind)) ind = bisect_right(L,A[-1]) if ind==len(L):break A.append(L.pop(ind)) ans += 1 print(ans)