t=input()
while(t>0):
    A=[]
    n=input()
    for i in range(n):
        A.append(raw_input())
    B=list(set(A))
    C=[]
    for i in range(len(B)):
        C.append(A.count(B[i]))
    c=0
    for i in range(len(C)):
        if(C[i]%2!=0):
            c+=1
        else:
            continue
    print c
    t=t-1