#!/usr/bin/env python 
# -*- coding:utf-8 -*-
import math
import sys
n=int(input())
# n,t=list(map(int,input().split()))
# serial=input().split()
# a=list(map(int,input().split()))
for i in range(n):
    num=int(input())
    a=list(map(int,input().split()))
    a_u=list(set(a))
    count=[]
    for n in a_u:
        count.append(a.count(n))
    sum=0
    for c in count:
        sum+=(c//2)
        
    print(sum*2)
624974edf011ef4c36c32d7886add23c2953f9ab
<mask token>

<mask token>
for i in range(n):
    num = int(input())
    a = list(map(int, input().split()))
    a_u = list(set(a))
    count = []
    for n in a_u:
        count.append(a.count(n))
    sum = 0
    for c in count:
        sum += c // 2
    print(sum * 2)

<mask token>
n = int(input())
for i in range(n):
    num = int(input())
    a = list(map(int, input().split()))
    a_u = list(set(a))
    count = []
    for n in a_u:
        count.append(a.count(n))
    sum = 0
    for c in count:
        sum += c // 2
    print(sum * 2)

import math
import sys
n = int(input())
for i in range(n):
    num = int(input())
    a = list(map(int, input().split()))
    a_u = list(set(a))
    count = []
    for n in a_u:
        count.append(a.count(n))
    sum = 0
    for c in count:
        sum += c // 2
    print(sum * 2)

#!/usr/bin/env python 
# -*- coding:utf-8 -*-
import math
import sys
n=int(input())
# n,t=list(map(int,input().split()))
# serial=input().split()
# a=list(map(int,input().split()))
for i in range(n):
    num=int(input())
    a=list(map(int,input().split()))
    a_u=list(set(a))
    count=[]
    for n in a_u:
        count.append(a.count(n))
    sum=0
    for c in count:
        sum+=(c//2)
        
    print(sum*2)