You are given an array consisting of all integers from
inclusive. For example, if and , the array would be . What's the minimum number of elements you can delete to make the bitwise AND of the array non-zero?
A bitwise AND is a binary operation that takes two equal-length binary representations and performs the AND operation on each pair of the corresponding bits.
Input
The first line contains one integer () — the number of test cases. Then cases follow.
The first line of each test case contains two integers and () — the description of the array.
Output
For each test case, output a single integer — the answer to the problem.
Example
input
Copy
5 1 2 2 8 4 5 1 5 100000 200000
output
Copy
1 3 0 2 31072
ConversionConversion EmoticonEmoticon