import sequtils,strutils,algorithm var T = stdin.readline.parseInt for t in 1..T: var N = stdin.readline.parseInt L = stdin.readline.split.map(parseInt) A : array[2, int] cnt : int a,b : int L.sort(system.cmp) for l in L: if A[0] == 0 or l == a: A[0] += 1 a = l elif A[1] == 0 or l == b: A[1] += 1 b = l else: A[0] -= 1 A[1] -= 1 cnt += 1 if A[0] == 0: A[0] = A[1] a = b A[1] = 0 echo cnt