#!/usr/bin/env python3 # -*- coding: utf-8 -*- import array import collections def compute_maximum(bamboos): answer = 0 counter = collections.Counter(bamboos) if len(counter) < 3: return answer while True: cands = counter.most_common(3) if cands[-1][1] <= 0: return answer used = (cand[0] for cand in cands) counter.subtract(used) answer += 1 def main(): t = int(input()) for _ in range(t): _ = int(input()) bamboos = array.array("L", map(int, input().split())) print(compute_maximum(bamboos)) if __name__ == '__main__': main()