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.lang.reflect.Array;
import java.util.Comparator;
import java.util.StringTokenizer;

public class Main implements Runnable {

    static class MinHeap<T> {

        private Comparator<T> comp;
        private T[] array;
        private int size;

        @SuppressWarnings("unchecked")
        MinHeap(Class<T> clazz, int capacity, Comparator<T> comp) {
            array = (T[]) Array.newInstance(clazz, capacity + 1);
            this.comp = comp;
            size = 0;
        }

        public void insert(T el) {
            size++;
            array[size] = el;
            int k = size;
            while (k > 1 && comp.compare(array[k], array[k / 2]) < 0) {
                swap(k, k / 2);
                k = k / 2;;
            }
        }

        public void clear() {
            for (int i = 1; i <= size; i++) {
                array[i] = null;
            }
            size = 0;
        }

        private void swap(int i, int j) {
            T t = array[i];
            array[i] = array[j];
            array[j] = t;
        }

        public T getMin() {
            if (size == 0) {
                return null;
            }
            return array[1];
        }

        public T extractMin() {
            if (size == 0) {
                return null;
            }
            T res = array[1];
            swap(1, size);
            array[size] = null;
            size--;
            int k = 1;
            while (2 * k <= size) {
                int j = 2 * k;
                if (2 * k < size
                                && comp.compare(array[k * 2], array[k * 2 + 1]) > 0) {
                    j++;
                }
                if (comp.compare(array[k], array[j]) < 0) {
                    break;
                }
                swap(k, j);
                k = j;
            }
            return res;
        }
    }

    static class Element {

        int value;
        int ind;

        Element(int value, int ind) {
            this.value = value;
            this.ind = ind;
        }
    }

    private void solve() throws IOException {
        int n = nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = nextInt();
        }
        int[] firstBiggestIndex = new int[n];

        MinHeap<Element> heap = new MinHeap<Element>(Element.class, n,
                        new Comparator<Element>() {

                            @Override
                            public int compare(Element i, Element j) {
                                if (i.value < j.value) {
                                    return -1;
                                }
                                if (i.value > j.value) {
                                    return 1;
                                }
                                return 0;
                            }
                        });
        for (int i = 0; i < n; i++) {
            Element cur = heap.getMin();
            while (cur != null && cur.value < array[i]) {
                heap.extractMin();
                firstBiggestIndex[cur.ind] = i;
                cur = heap.getMin();
            }
            heap.insert(new Element(array[i], i));
        }

        int max = Integer.MIN_VALUE;
        for (int i = 0; i < n - 1; i++) {
            if ((array[i] ^ array[i + 1]) > max) {
                max = array[i] ^ array[i + 1];
            }
            if (array[i] > array[i + 1]) {
                int k = firstBiggestIndex[i + 1];
                while (k != 0 && array[k] < array[i]) {
                    if ((array[i] ^ array[k]) > max) {
                        max = array[i] ^ array[k];
                    }
                    k = firstBiggestIndex[k];
                }
                if (k != 0) {
                    if ((array[i] ^ array[k]) > max) {
                        max = array[i] ^ array[k];
                    }
                }
            }
        }
        writer.println(max);
    }

    public static void main(String[] args) {
        new Main().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    @Override
    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        }
        catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

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

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

}
