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.*;
import java.util.*;

public class Main {
	
	static int[] x;
	static int answ = 0;

	static void check(int[] y, int v) {
		int max = -1;
		for (int yy : y) {
			if (yy > max) answ = Math.max(answ, yy ^ v);
			max = Math.max(max, yy);
		}
	}

	public static void main(String[] args) throws Exception {
		long time = System.nanoTime();

		int n = next();
		x = next(n);

		int or = 0;
		for (int xx : x) or |= xx;
		int and = (1 << 31) - 1;
		for (int xx : x) and &= xx;

		int xor = (1 << 30);
		while ((xor & or) == 0 || (xor & and) != 0) xor >>= 1;

		int[] index = new int[n + 2];
		int ind = 0;
		index[ind++] = -1;
		for (int i = 0; i < n; i++) if ((x[i] & xor) != 0) index[ind++] = i;
		index[ind++] = n;

		for (int i = 1; i < ind - 1; i++) {
			int len = index[i] - index[i - 1] - 1;
			int[] y = new int[len];
			for (int j = 0; j < len; j++) y[j] = x[index[i] - 1 - j];
			check(y, x[index[i]]);

			len = index[i + 1] - index[i] - 1;
			y = new int[len];
			for (int j = 0; j < len; j++) y[j] = x[index[i] + 1 + j];
			check(y, x[index[i]]);

		}

		out.println(answ);
		
//		System.out.println((System.nanoTime() - time)* 1e-9);
		out.close();
	}
	static PrintWriter out = new PrintWriter(System.out);
	
	static BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer in = new StringTokenizer("");

	static String nextToken() throws Exception {
		if (!in.hasMoreTokens()) in = new StringTokenizer(bufferedreader.readLine());
		return in.nextToken();
	}

	static int next()  throws Exception {return Integer.parseInt(nextToken());};
	static int[] next(int n) throws Exception {
		int[] x = new int[n];
		for (int i = 0; i < n; i++) x[i] = next();
		return x;
	}
	static int[][] next(int n, int m) throws Exception {
		int[][] x = new int[n][];
		for (int i = 0; i < n; i++) x[i] = next(m);
		return x;
	}

	static long nextl() throws Exception {return Long.parseLong(nextToken());};
	static long[] nextl(int n) throws Exception {
		long[] x = new long[n];
		for (int i = 0; i < n; i++) x[i] = nextl();
		return x;
	}
	static long[][] nextl(int n, int m) throws Exception {
		long[][] x = new long[n][];
		for (int i = 0; i < n; i++) x[i] = nextl(m);
		return x;
	}

	static double nextd() throws Exception {return Double.parseDouble(nextToken());};
	static double[] nextd(int n) throws Exception {
		double[] x = new double[n];
		for (int i = 0; i < n; i++) x[i] = nextd();
		return x;
	}
	static double[][] nextd(int n, int m) throws Exception {
		double[][] x = new double[n][];
		for (int i = 0; i < n; i++) x[i] = nextd(m);
		return x;
	}

	static String nextline() throws Exception {
		in = new StringTokenizer("");
		return bufferedreader.readLine();
	}

}