# 同じ長さでない3本を選べばいい # 長さごとに本数を数えて、本数降順として使うか # それで間に合うか? N<100なので間に合うかも T = int(input()) for t in range(T): N = int(input()) L = list(map(int, input().split())) from collections import Counter counted = Counter(L) #print(counted) #print(type(counted)) counted_list = [] for n, c in counted.items(): counted_list.append([n, c]) counted_list.sort(key = lambda x:-x[1]) #print(counted_list) count = 0 while True: subcount = 0 for i in range(len(counted_list)): if counted_list[i][1] > 0: subcount += 1 counted_list[i][1] -= 1 if subcount == 3: count += 1 break #print('count', count, 'subcount', subcount, counted_list) if subcount < 3: break print(count)