You are given a complete graph consisting of nodes, each with a value of . The weight of the edge between nodes and nodes is , where denotes the XOR operator. You wish to build the Minimum Spanning Tree (MST) of this graph.
Can you output the position of the highest one bit of the heaviest edge in the MST?
Input Specification
The first line will contain , the number of test cases. test cases follow.
For each test case, the first line will contain the integer , the number of nodes.
The second line will contain integers, .
Output Specification
For each test case, output the position of the highest one bit of the heaviest edge in the MST on its own line, or -1
if there is no ones bit.
Sample Input
2
4
3 7 4 1
2
100 100
Sample Output
2
-1
Explanation for Sample
The heaviest edge's binary representation is 100
, whose highest one bit is in position 2 (Note the zero indexing).
Comments