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

/**
 * @author Ivan Romanov
 */
public class B {

    private int[] md;
    int n2;
    int n;

    private void solve() throws IOException {
        n = nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
//        n = 100000;
//        int[] a = new int[n];
//        long seed = System.currentTimeMillis();
//        System.err.println("seed=" + seed);
//        Random r = new Random(seed);
//        Set<Integer> was = new HashSet<Integer>();
//        for (int i = 0; i < n; i++) {
//            int v = r.nextInt(1000000000) + 1;
//            while (was.contains(v)) {
//                v = r.nextInt(1000000000) + 1;
//            }
//            a[i] = v;
//            was.add(v);
//        }
//        System.err.println("generated.");
        n2 = 1;
        while (n2 <= n) {
            n2 <<= 1;
        }
        md = new int[n2 * 2 + 1];
        for (int i = 0; i < n; i++) {
            md[n2 + i] = a[i];
        }
        for (int i = n2 - 1; i >= 1; i--) {
            md[i] = Math.max(md[i * 2], md[i * 2 + 1]);
        }
//        stress(a);
        Map<Integer, Integer> index = new HashMap<Integer, Integer>();
        for (int i = 0; i < n; i++) {
            index.put(a[i], i);
        }
        int res = a[0] ^ a[1];
        SortedSet<Integer> values = new TreeSet<Integer>();
        values.add(a[0]);
        values.add(a[1]);
        for (int k = 2; k < n; k++) {
//            int j = k - 1;
//            int max = 0;
//            while (j >= 0 && a[j] < a[k]) {
//                if (max < a[j]) {
//                    max = a[j];
//                    res = Math.max(res, max ^ a[k]);
//                }
//                j--;
//            }
//            if (j >= 0 && a[j] > a[k]) {
//                res = Math.max(res, a[j] ^ a[k]);
//            }

            // find rightmost item greater than a[k]

            int i = k - 1;
            if (values.last() < a[k]) {
                i = -1;
            } else {
                while (i >= 0 && a[i] < a[k]) {
                    i--;
                }
            }

            if (i >= 0) {
                res = Math.max(res, a[i] ^ a[k]);
            }
            int j = i;
            while (j + 1 < k) {
                int max = getMax(j + 1, k - 1);
                res = Math.max(res, max ^ a[k]);
                j = index.get(max);
            }
            values.add(a[k]);
        }
        writer.println(res);
    }

    private int getMax(int i, int j) {
        return getMax(1, 0, n2 - 1, i, j);
    }

    private void stress(int[] a) {
        System.err.println(Arrays.toString(a));
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                int max = 0;
                for (int k = i; k <= j; k++) {
                    max = Math.max(max, a[k]);
                }
                int mdMax = getMax(i, j);
                if (mdMax != max) {
                    System.err.println("max on segment [" + i + ".." + j + "] is " + max + " but got: " + mdMax);
                }
            }
        }
    }

    private int getMax(int v, int a, int b, int l, int r) {
        if (l > r) {
            return -1;
        }
        if (a == l && b == r) {
            return md[v];
        }
        int mid = (a + b) / 2;
        int res1 = getMax(v * 2, a, mid, l, Math.min(r, mid));
        int res2 = getMax(v * 2 + 1, mid + 1, b, Math.max(mid + 1, l), r);
        if (res1 < res2) {
            res1 = res2;
        }
        return res1;
    }

    PrintWriter writer;

    private BufferedReader reader;

    private StringTokenizer tt = new StringTokenizer("");

    private String nextToken() throws IOException {
        while (!tt.hasMoreTokens()) {
            tt = new StringTokenizer(reader.readLine());
        }
        return tt.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private void run() throws IOException {
        reader = new BufferedReader(new InputStreamReader(System.in));
        writer = new PrintWriter(System.out);
        try {
            long start = System.currentTimeMillis();
            solve();
            long elapsed = System.currentTimeMillis() - start;
//            System.err.println(elapsed + "ms");
        } finally {
            reader.close();
            writer.close();
        }
    }

    public static void main(String[] args) {
        try {
            new B().run();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}