OR-XOR

3.8

5 votes
, Basic Programming
Problem

Given an array A of size N, you could choose some non-negative number X and change every element of the given array to Ai=AiX

Here, denotes the bitwise XOR operation.

Print the number of total possible values of X for which bitwise OR of every element of the array would be minimum.

Input format

  • The first line contains T denoting the number of test cases.
  • The first line of each test case contains integers N, denoting the size of the array A.
  • The next line contains N integers.

Output format

Print the number of total possible values of X for which bitwise OR of every element of the array would be minimum.

Constraints

1T5000
1N105
0Ai109

The sum of N over all test cases does not exceed 2105

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Here minimum possible bitwise OR of the array is 5.

All possible values for 'X' are 0,1,4,5.

Editor Image

?