You are given an array A of N integers. Determine the minimum value of the following expression for all valid i,j:
(Ai and Aj) xor (Ai or Aj), where i≠j.
Input format
Output format
For each test case, print a single line containing one integer that represents the minimum value of the given expression
Constraints
1≤T≤1031≤N≤1050≤Ai≤109
Note: Sum of N overall test cases does not exceed 106
For test case #1, we can select elements 2 and 3, the value of the expression is (2 and 3) xor (2 or 3)=1, which is the minimum possible value. Another possible pair is 4 and 5.
For test case #2, we can select elements 4 and 7, the value of the expression is (4 and 7) xor (4 or 7)=3, which is the minimum possible value.