You are given an array of integers. Now, let’s define two variables and . Where is the bitwise XOR value of all elements for any non-empty prefix. And is the bitwise XOR value of all elements for any non-empty suffix. Now find the maximum value of . Where denotes the bitwise AND operation.
Note that, the sum of the length of chosen prefix and suffix has to be less than or equal to .
The first line of the input contains one integer denoting the number of elements of the array.
The next line contains n space-separated integers denoting the elements of the array.
Print the maximum value of as described in the statement.
Input | Output |
---|---|
2 12 12 | 12 |
Input | Output |
---|---|
4 2 4 2 4 | 6 |