Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1, x2, ..., xk (k > 1) is such maximum element xj, that the following inequality holds: <image>.

The lucky number of the sequence of distinct positive integers x1, x2, ..., xk (k > 1) is the number that is equal to the bitwise excluding OR of the maximum element of the sequence and the second maximum element of the sequence.

You've got a sequence of distinct positive integers s1, s2, ..., sn (n > 1). Let's denote sequence sl, sl + 1, ..., sr as s[l..r] (1 ≤ l < r ≤ n). Your task is to find the maximum number among all lucky numbers of sequences s[l..r].

Note that as all numbers in sequence s are distinct, all the given definitions make sence.

Input

The first line contains integer n (1 < n ≤ 105). The second line contains n distinct integers s1, s2, ..., sn (1 ≤ si ≤ 109).

Output

Print a single integer — the maximum lucky number among all lucky numbers of sequences s[l..r].

Examples

Input

5
5 2 1 4 3


Output

7


Input

5
9 8 3 5 7


Output

15

Note

For the first sample you can choose s[4..5] = {4, 3} and its lucky number is (4 xor 3) = 7. You can also choose s[1..2].

For the second sample you must choose s[2..5] = {8, 3, 5, 7}.
import sys

input_lines = [line.strip() for line in sys.stdin.readlines() if line.strip()]

n = int(input_lines[0])
array = [int(x) for x in input_lines[1].split()]

def directional_max_xor(array, n):
	max_xor = 0
	stack = [array[0]]
	for i in range(1, n):
		if array[i] > stack[-1]:
			_1st_max = array[i]

			while len(stack) > 0 and _1st_max > stack[-1]:
				_2nd_max = stack.pop()
				max_xor = max(max_xor, _1st_max ^ _2nd_max)
				
			
		stack.append(array[i])
	return max_xor

max_xor_RIGHT = directional_max_xor(array, n)

array = array[::-1]

max_xor_LEFT = directional_max_xor(array, n)

print(max(max_xor_LEFT, max_xor_RIGHT))

'''
=============================== PRIME IDEA ===================================
similar to the SECONDARY IDEA, we know that each element in the array can be 2nd maximum for at most 1 subarray on the left side and at most 1 subarray on the right side.

we will use a stack to maintain decreasing elements, given a new element:
	- if the new element is smaller than the top of the stack: (A)
		+ the new element is now considered as a 2nd maximum for some subarray on its left side. (1)
		+ due to how this algorithm runs, the top of the stack is the right previous greater element in the original array.
		+ the top of the stack must be the maximum of such subarray mentioned in (1) because the top of the stack is greater than the new element.
		+ now, we can XOR them and update the value for the MAX_XOR.
		+ finally, we push the new element into the stack.
	- because the array is distint -> the other case is "if the new element is greater than the top of the stack":
		+ the top of the stack appears in the stack only after it is pushed by step (A) -> the top of the stack has once been considered as 2nd maximum for some subarray on its left side.
		-> now, we consider the top of the stack as a 2nd maximum for some subarray on its right side (2) -> we don't miss anything
		+ the new element is the first next greater element for the top of the stack because if it's not, the top of the stack is already popped out.
		-> because the new element is greater than the top -> the new element is the maximum for such subarray mentioned in (2).
		+ now, we can XOR them and update the value for the MAX_XOR
		+ finally, we pop the top of the stack.
		+ we will repeat all the above (+) steps until the new element is smaller than the new top -> go to (A).


=============================== SECONDARY IDEA ===============================
The key idea for this problem is that we need to consider each element array[i] as the second maximum of some subarray. In this way, what we need to do is to find the maximum of such subarray for array[i]. The important fact that we need to use here is that all elements are distinct -> no two elements are equal. Due to this fact, we can prove that:
	"each element can become the second maximum of at most 1 subarray on its left side and at most 1 subarray on its right side" (*)
		-> suppose that array[i] is the 2nd maximum of the subarray array[i:i+k] -> there must be an element array[j] (i < j < i + k) which is the maximum of this array, i.e., 
		array[j] > array[i] -> array[i] cannot be 2nd maximum of any other subarray from i to i + l (l > k) that has a maximum > array[j] (because array[j] would be 2nd maximum for that subarray). (1)
		array[i] can also not be a 2nd maximm of any other subarray from i to i + z (z < k) that has a maximum < array[j] (because array[i] would be 3rd maximum of array[i:i+k], which is a contradiction). (2)
		-> similarly, we can prove that it's true for the left side 

the fact that no two elements are equal, because only then, the reasoning for (1) and (2) can be correct as it assumes that 2nd maximum needs to be strictly smaller than the maximum.
Note that, one element may not be 2nd maximum of any subarray if it is the maximum of the whole array.

under the observation (*) and (1), (2), what we need to do is to find the first next greater (on the right side) and the first previous greater (on the left side) element for each element in the array. These two greater elements for each array[i] would be the two maximum elements (we're sure, because each element cannot have more than 2 maximum) for two subarrays which the current element might be the 2nd maximum for.

======================= finding next greater element ======================
this is directly applied for the right side. FOr the left side, we can just reverse the array and run this again.

the idea for finding the next greater element is that:
	for each element array[i], array[i:i+c] is its longest decreasing subarray (c is the largest value that you can make array[i:i+c] decreasing), all elements in array[i:i+c] would share the same "next greater element".

	with this idea, we will maintain a stack that stores all elements in array[i:i+c], once a new element array[i+c+1] appears and array[i:i+c+1] > the top of the stack, which is array[i+c], we will pop the top of the stack until the stack is empty or the top of the stack is greater than the new element -> now, we can push the new element into the stack.
'''
