t = input()
for tc in xrange(t):
    n = input()
    x = []
    for names in xrange(n):
        a = raw_input()
	x.append(a)
    y = set(x)
    count=0
    for names in y:
	if x.count(names)%2!=0:
	    count+=1
    print count