#abc197c. [abc197_c]ORXOR

[abc197_c]ORXOR

Problem Statement

Given is a number sequence AA of length NN.
Let us divide this sequence into one or more non-empty contiguous intervals.
Then, for each of these intervals, let us compute the bitwise mathrmOR\\mathrm{OR} of the numbers in it.
Find the minimum possible value of the bitwise mathrmXOR\\mathrm{XOR} of the values obtained in this way.

What is bitwise mathrmOR\\mathrm{OR}?

The bitwise mathrmOR\\mathrm{OR} of integers AA and BB, AmathrmORBA\\ \\mathrm{OR}\\ B, is defined as follows:

  • When AmathrmORBA\\ \\mathrm{OR}\\ B is written in base two, the digit in the 2k2^k's place (kgeq0k \\geq 0) is 11 if at least one of AA and BB is 11, and 00 otherwise.

For example, we have 3mathrmOR5=73\\ \\mathrm{OR}\\ 5 = 7 (in base two: 011mathrmOR101=111011\\ \\mathrm{OR}\\ 101 = 111).
Generally, the bitwise mathrmOR\\mathrm{OR} of kk integers p1,p2,p3,dots,pkp_1, p_2, p_3, \\dots, p_k is defined as $(\\dots ((p_1\\ \\mathrm{OR}\\ p_2)\\ \\mathrm{OR}\\ p_3)\\ \\mathrm{OR}\\ \\dots\\ \\mathrm{OR}\\ p_k)$. We can prove that this value does not depend on the order of p1,p2,p3,dotspkp_1, p_2, p_3, \\dots p_k.

What is bitwise mathrmXOR\\mathrm{XOR}?

The bitwise mathrmXOR\\mathrm{XOR} of integers AA and BB, AmathrmXORBA\\ \\mathrm{XOR}\\ B, is defined as follows:

  • When AmathrmXORBA\\ \\mathrm{XOR}\\ B is written in base two, the digit in the 2k2^k's place (kgeq0k \\geq 0) is 11 if exactly one of AA and BB is 11, and 00 otherwise.

For example, we have 3mathrmXOR5=63\\ \\mathrm{XOR}\\ 5 = 6 (in base two: 011mathrmXOR101=110011\\ \\mathrm{XOR}\\ 101 = 110).
Generally, the bitwise mathrmXOR\\mathrm{XOR} of kk integers p1,p2,p3,dots,pkp_1, p_2, p_3, \\dots, p_k is defined as $(\\dots ((p_1\\ \\mathrm{XOR}\\ p_2)\\ \\mathrm{XOR}\\ p_3)\\ \\mathrm{XOR}\\ \\dots\\ \\mathrm{XOR}\\ p_k)$. We can prove that this value does not depend on the order of p1,p2,p3,dotspkp_1, p_2, p_3, \\dots p_k.

Constraints

  • 1leNle201 \\le N \\le 20
  • 0leAilt2300 \\le A_i \\lt 2^{30}
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN A1A_1 A2A_2 A3A_3 dots\\dots ANA_N

Output

Print the answer.


Sample Input 1

3
1 5 7

Sample Output 1

2

If we divide \[1, 5, 7\] into \[1, 5\] and \[7\], their bitwise mathrmOR\\mathrm{OR}s are 55 and 77, whose mathrmXOR\\mathrm{XOR} is 22.
It is impossible to get a smaller result, so we print 22.


Sample Input 2

3
10 10 10

Sample Output 2

0

We should divide this sequence into \[10\] and \[10, 10\].


Sample Input 3

4
1 3 3 1

Sample Output 3

0

We should divide this sequence into \[1, 3\] and \[3, 1\].