CF2094E Boneca Ambalabu
Description
Boneca Ambalabu gives you a sequence of $ n $ integers $ a_1,a_2,\ldots,a_n $ .
Output the maximum value of $ (a_k\oplus a_1)+(a_k\oplus a_2)+\ldots+(a_k\oplus a_n) $ among all $ 1 \leq k \leq n $ . Note that $ \oplus $ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR).
Input Format
The first line contains an integer $ t $ ( $ 1 \leq t \leq 10^4 $ ) – the number of independent test cases.
The first line of each test case contains an integer $ n $ ( $ 1 \leq n\leq 2\cdot 10^5 $ ) – the length of the array.
The second line of each test case contains $ n $ integers $ a_1,a_2,\ldots,a_n $ ( $ 0 \leq a_i < 2^{30} $ ).
It is guaranteed that the sum of $ n $ over all test cases does not exceed $ 2\cdot 10^5 $ .
Output Format
For each test case, output the maximum value on a new line.
Explanation/Hint
In the first test case, the best we can do is $ (18\oplus18)+(18\oplus18)+(18\oplus18)=0 $ .
In the second test case, we choose $ k=5 $ to get $ (16\oplus1)+(16\oplus2)+(16\oplus4)+(16\oplus8)+(16\oplus16)=79 $ .