import java.io.BufferedInputStream; import java.io.IOException; import java.lang.reflect.Array; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.Map.Entry; public class Main { public static final int C = 1000000007; //static boolean MAP[][]; static int N; static int Q; static int MAX = -1; //static int tic[][]; static boolean NUM[]; //static int max; static int A[]; static int ST[][]; //static int p[]; //static ArrayList> al; static TreeMap> hm; //static ArrayList al; //static int a[][]; //static char[][] ch; //static ArrayList> al; //static String a[]; //static String str; //static int[] mach = new int[] {6, 2, 5, 5, 4, 5, 6, 3, 7, 6}; public static void main(String[] args) { StringBuilder sb = new StringBuilder(); BufferedInputStream bs = new BufferedInputStream(System.in); Scanner sc = new Scanner(bs); int T = sc.nextInt(); int n[] = new int[T]; //int a[][] = new int[T][1000000001]; ArrayList> al = new ArrayList>(); for (int t=0; t < T; t++) { n[t] = sc.nextInt(); //a[i] = new int[n[i]]; al.add(new HashMap()); for (int i = 0; i < n[t]; i++) { //a[t][sc.nextInt()]++; int num = sc.nextInt(); HashMap hm = al.get(t); hm.put(num, hm.containsKey(num)?hm.get(num)+1:1); } } //N = sc.nextInt(); int ans[] = new int[T]; for (int t=0; t < T; t++) { int num = 0; HashMap hm = al.get(t); LOOP:while (true) { Iterator> it = hm.entrySet().iterator(); while(it.hasNext()) { Entry e = it.next(); e.setValue(e.getValue()-1); num++; if (e.getValue() ==0) { it.remove(); } if (num == 3) { ans[t]++; num = 0; continue LOOP; } } break LOOP; } } for (int i=0; i < T; i++) { sb.append(ans[i]+ "\n"); } System.out.print(sb); } }