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

import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.OutputStream;



public class xorMax {

    public static void main(String [] argv) {
        Kattio io = new Kattio(System.in, System.out);
        int n = io.getInt();
        int [] A = new int [n];
        for (int i=0; i<n; i++)
            A[i] = io.getInt();
        io.println(XOR_maximize(A));
        io.close();
    }

    static int  XOR_maximize(int [] A) {
        int N = A.length;

        //int [] mSetBit = new int [n];
        for (int i=30; i>=0; i--) { // can i be 0? - YES, s = {2, 3}, but then the answer is always '1'
            if (i==0) return 1;
            List<Integer> idxSetBit = new ArrayList<Integer>();
            for (int j=0; j<N; j++)
                if ((A[j]&(1<<i)) != 0)
                    idxSetBit.add(j);
            if (idxSetBit.isEmpty()) continue;
            if (idxSetBit.size() == N) continue; // they all have that bit set!

            int k = idxSetBit.size();
            /*System.out.println("i = " + i);
            System.out.println(idxSetBit);
            System.out.println();*/
            // Special cases handled!
            int [] minFrom = new int [k];
            int [] maxFrom = new int [k];
            minFrom[0] = 0;
            maxFrom[k-1] =N-1;
            for (int ii=1; ii<k; ii++)
                minFrom[ii] = idxSetBit.get(ii-1)+1;
            for (int ii=0; ii<k-1; ii++)
                maxFrom[ii]= idxSetBit.get(ii+1)-1;
            /*
            System.out.print("maxFrom: ");
            for (int ii=0; ii<k; ii++)
                System.out.print(maxFrom[ii] + " ");
            System.out.println();

            System.out.print("minFrom: ");
            for (int ii=0; ii<k; ii++)
                System.out.print(minFrom[ii] + " ");
            System.out.println();*/


            int best = 0;
            // Now find the max!

            for (int ii=0; ii<k; ii++) {
                // interval : idxSetBit.get(ii) .. maxFrom[ii]
                int theBigOne = A[idxSetBit.get(ii)];
                int bestHere = 0;
                int maxVal = 0;
                for (int j=idxSetBit.get(ii); j<= maxFrom[ii]; j++)
                    if (A[j] != theBigOne) { // can't be max
                        // only OK if it's second max
                        if (A[j] > maxVal) {
                            maxVal = A[j];
                            bestHere = max(bestHere, theBigOne^A[j]);
                        }
                    }
                best = max(bestHere, best);

                // interval : minFrom[ii] .. idxSetBit.get(ii)
                //int theBigOne = A[idxSetBit.get(ii)];
                //int bestHere = 0;
                maxVal = 0;
                for (int j=idxSetBit.get(ii); j>= minFrom[ii]; j--)
                    if (A[j] != theBigOne) { // can't be max
                        // only OK if it's second max
                        if (A[j] > maxVal) {
                            maxVal = A[j];
                            bestHere = max(bestHere, theBigOne^A[j]);
                        }
                    }
                best = max(bestHere, best);
            }
            return best;
        }
        throw new Error("Bug! It should return before it gets here!");
    }
}


/** Simple yet moderately fast I/O routines.
 *
 * Example usage:
 *
 * Kattio io = new Kattio(System.in, System.out);
 *
 * while (io.hasMoreTokens()) {
 *    int n = io.getInt();
 *    double d = io.getDouble();
 *    double ans = d*n;
 *
 *    io.println("Answer: " + ans);
 * }
 *
 * io.close();
 *
 *
 * Some notes:
 *
 * - When done, you should always do io.close() or io.flush() on the
 *   Kattio-instance, otherwise, you may lose output.
 *
 * - The getInt(), getDouble(), and getLong() methods will throw an
 *   exception if there is no more data in the input, so it is generally
 *   a good idea to use hasMoreTokens() to check for end-of-file.
 *
 * @author: Kattis
 */


class Kattio extends PrintWriter {
    public Kattio(InputStream i) {
        super(new BufferedOutputStream(System.out));
        r = new BufferedReader(new InputStreamReader(i));
    }
    public Kattio(InputStream i, OutputStream o) {
        super(new BufferedOutputStream(o));
        r = new BufferedReader(new InputStreamReader(i));
    }

    public boolean hasMoreTokens() {
        return peekToken() != null;
    }

    public int getInt() {
        return Integer.parseInt(nextToken());
    }

    public double getDouble() {
        return Double.parseDouble(nextToken());
    }

    public long getLong() {
        return Long.parseLong(nextToken());
    }

    public String getWord() {
        return nextToken();
    }



    private BufferedReader r;
    private String line;
    private StringTokenizer st;
    private String token;

    private String peekToken() {
        if (token == null)
            try {
                while (st == null || !st.hasMoreTokens()) {
                    line = r.readLine();
                    if (line == null) return null;
                    st = new StringTokenizer(line);
                }
                token = st.nextToken();
            } catch (IOException e) { }
        return token;
    }

    private String nextToken() {
        String ans = peekToken();
        token = null;
        return ans;
    }
}
