nikhil-and-binary-numbers
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

Nikhil has written N binary integers (i.e. eithim zero or one) on a copy. He recently learned about XOR operation. Now He wants to erase exactly one integer in the array so that the XOR of the remaining N - 1 numbers is zero. Please help him to calculate the number of ways of doing so.

Input

The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The first line of each test case contains a single integer N denoting the number of numbers that Nikhil has written on a blackboard.
The second line contains N space-separated integers A1, A2, ..., AN denoting the numbers He had written.

Output

For each test case, output a single line containing the number of ways to erase exactly one integer so that the XOR of the remaining integers is zero. The ways when you erase the same integer but on different places in the given sequence are considered different.

Constraints

1 = T = 20
2 = N = 10^5
0 = Ai = 1

SAMPLE INPUT
2
5
1 0 0 0 0
5
1 1 1 1 1

SAMPLE OUTPUT
1
5

Explanation

Example case 1. If you erase the first number on the blackboard, then the XOR of the rest of numbers will be equal to zero.
Example case 2. You can erase any of the given 5 numbers, it will make the XOR of the rest equal to zero.


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a0 = a.count(0)
	a1 = a.count(1)
	print(n if a1 == 0 else a1 if a1 % 2 else a0)


for _ in range(eval(input())):
	n=eval(input())
	m=list(map(int,input().split()))
	a=m.count(1)
	b=n-a
	print(a if a%2==1 else b)


p=int(input())
for j in range(p):
	p=int(input())
	s=input().split()
	k=s.count('1')
	k1=s.count('0')
	if k==0:
		print(p)
	elif k%2!=0:
		print(k)
	else:
		print(k1)