T = int(input()) def kado(): N = int(input()) L = list(map(int, input().strip().split(" "))) total = 0 for i in range(len(L)): if L[i] == 0: continue for j in range(i+1, len(L)): for k in range(j+1, len(L)): if L[i] == 0 or L[j] == 0 or L[k] == 0: break if (L[i] != L[j]) and (L[j] != L[k]) and (L[k] != L[i]): L[i] = L[j] = L[k] = 0 total += 1 return total print("\n".join([str(kado()) for i in range(T)]))