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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Objects;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jenish
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BMaximumXorSecondary solver = new BMaximumXorSecondary();
        solver.solve(1, in, out);
        out.close();
    }

    static class BMaximumXorSecondary {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            long arr[] = new long[n];
            long arrR[] = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = in.scanLong();
                arrR[n - i - 1] = arr[i];
            }

            out.println(Math.max(sov(arr), sov(arrR)));

        }

        long sov(long arr[]) {
            long ans = arr[0] ^ arr[1];
            Stack<Long> st = new Stack<>(arr.length + 5);
            int n = arr.length;
            for (int i = 0; i < n; i++) {
                while (!st.isEmpty() && st.peek() < arr[i]) st.pop();
                st.push(arr[i]);
                if (st.getSize() >= 2) {
                    long a = st.pop();
                    long b = st.pop();
                    st.push(b);
                    st.push(a);
                    ans = Math.max(ans, a ^ b);
                }
            }

            return ans;
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int INDEX;
        private BufferedInputStream in;
        private int TOTAL;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (INDEX >= TOTAL) {
                INDEX = 0;
                try {
                    TOTAL = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (TOTAL <= 0) return -1;
            }
            return buf[INDEX++];
        }

        public int scanInt() {
            int I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

        public long scanLong() {
            long I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

    }

    static class Stack<T> {
        private int size;
        private T[] arr;
        private int top;

        public Stack() {
            this.size = Integer.MAX_VALUE;
            this.top = -1;
            arr = (T[]) new Objects[size];
        }

        public Stack(int size) {
            this.size = size;
            this.top = -1;
            arr = (T[]) new Object[size];
        }

        public boolean isFull() {
            return (top == size - 1);
        }

        public boolean isEmpty() {
            return (top == -1);
        }

        public void push(T t) {
            if (isFull()) {
                throw new ArrayIndexOutOfBoundsException("Stack is full");

            } else {
                top++;
                arr[top] = t;
            }
            return;
        }

        public T peek() {
            if (isEmpty()) {
                throw null;
            } else {
                return arr[top];
            }
        }

        public T pop() {
            if (isEmpty()) {
                throw new ArrayIndexOutOfBoundsException("Stack is Empty");
            } else {
                return arr[top--];
            }
        }

        public int getSize() {
            return top + 1;
        }

    }
}

