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 java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class A {
	public static void main(String[] args) throws IOException {
		InputReader in = new InputReader();
		n = in.nextInt();
		a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] =in.nextInt();
		build(1, 0, n-1);
		TreeSet<state> tr=  new TreeSet<state>();
		s.push(new state(0,n-1));
		int max = 0;
		state c;
		while(!s.isEmpty()){
			c=s.pop();
			if(tr.contains(c))continue;
			tr.add(c);
			max = Math.max(max, go(c.i,c.j));
		}
		System.out.println(max);
//		System.out.println(x);
	}
	int ret = 0;
	static int x=0;
	static Stack<state> s = new Stack<state>();
	static class state implements Comparable<state>{
		int i,j;

		public state(int i, int j) {
			this.i = i;
			this.j = j;
		}

		@Override
		public int compareTo(state x) {
			if(i!=x.i)return i-x.i;
			return j-x.j;
		}
		
	}
	public static int go(int i, int j) {
//		System.out.println(i+" "+j);
//		x++;
		if(i<0||j<0||i>=n||j>=n||i>=j)return 0;
		int p = get(1, 0, n-1, i, j);
		int p1 = get(1,0,n-1,p+1,j);
		int p2 = get(1,0,n-1,i,p-1);
		if(p==-1)return 0;
		int ret = 0;
		if(p1!=-1)ret = Math.max(ret, a[p]^a[p1]);
		if(p2!=-1)ret = Math.max(ret, a[p]^a[p2]);
//		if(p!=i&&p!=j) return Math.max(ret, Math.max(go(i,p), go(p,j)));
		s.push(new state(i,p-1));
		s.push(new state(p+1,j));
		if(p2!=-1)s.push(new state(p2+1,p));
		if(p1!=-1)s.push(new state(p,p1-1));
		return ret;
	}

	static int[] tr = new int[400000];
	static int[] a;
	static int n;
	
	public static void build(int node,int L, int R){
		if(L>R)return;
		if(L==R)
			tr[node]=L;
		else{
			int mid = (L+R)/2;
			build(2*node, L, mid);
			build(2*node+1,mid+1,R);
			if(a[tr[2*node]]>a[tr[2*node+1]])
				tr[node]=tr[2*node];
			else
				tr[node]=tr[2*node+1];
//			tr[node]=Math.max(tr[2*node], tr[2*node+1]);
		}
	}
	public static int get(int node , int L, int R,int i , int j){
		if(i<0||j<0||i>=n||j>=n)return -1;
		if(L>j||R<i)return -1;
		if(i<=L&&j>=R)return tr[node];
		int mid = (L+R)/2;
		int p1 = get(2*node, L, mid, i, j);
		int p2= get(2*node+1, mid+1, R, i, j);
		if(p1==-1)return p2;
		if(p2==-1)return p1;
		if(a[p1]>a[p2])return p1;
		return p2;
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer st;

		public InputReader() throws IOException {
			in = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer(in.readLine());
		}

		public String next() throws IOException {
			while (!st.hasMoreElements())
				st = new StringTokenizer(in.readLine());
			return st.nextToken();
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}
	}
}