SOLVE
LATER
Doing even the easiest of tasks in the most complicated way, is what ThunderCracker is expert at! Recently, he came across a simple problem :
"Given an array A of positive integers, find if it is possible to divide it into 2 subsets, such that every element in A belongs to exactly one subset, and both the subsets thus formed are exactly the same."
(Two subsets are said to be same if they contain the same elements and the frequency of all elements is the same in both of them)
For example, \([1, 1, 2, 2]\) can be divided into \([1, 2]\) and \([1, 2]\).
\([1, 2, 3, 1]\) , however, has no such division.
To solve this problem, ThunderCracker came up with a super-weird solution. He found the \(XOR\) of all elements in the array! He believes that a division is possible if the \(XOR\) is 0. Otherwise, it is not.
Soon, he realised that the solution doesn't work for every array. (\([1, 2, 3]\), for example!)
Nonetheless, he came up with an interesting task for you :
" Given an array A, find the number of non-empty subsequences of A, where ThunderCracker's solution gives the correct output! "
Help him solve the task!!
The first line of the input consists of a single integer T, denoting the number of test cases. T test cases follow.
The first line of a test case contains a single integer N, denoting the size of array A.
The second line contains N space separated integers, that represent the array A.
For every test case, print on a new line, a single integer, that is the number of subsequences of A, where ThunderCracker's solution matches the expected output. As the answer can be very large, output it modulo \(1000000007\). (\(10^9 + 7\))
\(1 ≤ T ≤ 5\)
\(1 ≤ N ≤ 10^5\)
\(1 ≤ A[i] ≤ 10^9\)
Subtask | Points |
---|---|
\(1 \leq A[i] \leq 20\) | \(20\%\) |
\(1 \leq A[i] \leq 1000\) | \(50\%\) |
Original Constraints | \(30\%\) |
For the first test case, let us check for all the non-empty subsequences of A.
Subsequence | Correct Answer | ThunderCracker's Answer |
---|---|---|
{1} | No | No |
{2} | No | No |
{3} | No | No |
{1, 2} | No | No |
{1, 3} | No | No |
{2, 3} | No | No |
{1, 2, 3} | No | Yes |