O - Or Exclusive Sum

Time limit: 3 s
Memory limit: 1024 MiB
Languages: C, C++, Java, Python, ... (details)

Given a list $A$ with $n$ positive integers. You are allowed to change at most two elements from the list into any two elements of your choice.


Your goal is to maximize the formula:


$S = \sum_{i=1}^{n-1} A_i \oplus A_{i+1}$


where the symbol $\oplus$ stands for the xor operation (or exclusive).

Input

First line of input contains an integer $n$ $(2 \le n \le 10^5)$, the size of the list. Second line contains the elements of $A$ separated by space such that $(0 \le A_i < 2^{30})$ for $i = 1, 2, \ldots, n$.

Output

Print a single integer, the maximum value of $S$ you can get.


Note: The new values of $A$ must remain withing the range $[0, 2^{30})$.

Sample test(s)

Input
2 0 1
Output
1073741823
Input
3 1 2 3
Output
2147483646