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}.
/* LA KE 3 PEG BALLIYE
*/
import java.io.PrintWriter;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.*;

/* Built using CHelper plug-in
* Solution By SANYAM ARORA
*/
//MY CODE STARTS HERE//

public class codeforces{
    static class pair implements Comparable<pair> {
        int a, b;

        public pair(int a, int b) {
            this.a = a;
            this.b = b;
        }


        @Override
        public int compareTo(pair p) {
            return this.b - p.b;
        }
    }
    static  FastReader in;
    static PrintWriter out;
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
         in = new FastReader(inputStream);
         out = new PrintWriter(outputStream);
        Ques solver;
        solver = new Ques();
      //int testNumber=in.nextInt();
       // while(testNumber-->0)
            solver.solve(1, in, out);
        out.close();
    }

    static class Ques {
        public void solve(int testNumber, FastReader sc, PrintWriter out){
            int n = sc.nextInt();
            int[] arr = new int[n];
            for (int i = 0; i < n; i++)
                arr[i] = sc.nextInt();
            Stack<Integer> st = new Stack<>();
            int[] leftBigger = new int[n], rightBigger = new int[n];
            int INF = (int) 1e9 + 100;
            st.push(INF);
            for (int i = 0; i < n; i++) {
                while (st.peek() < arr[i]) st.pop();
                leftBigger[i] = st.peek();
                st.push(arr[i]);
            }
            st.clear();
            st.push(INF);
            for (int i = n - 1; i >= 0; i--) {
                while (st.peek() < arr[i]) st.pop();
                rightBigger[i] = st.peek();
                st.push(arr[i]);
            }

            int max = 0;
            for (int i = 0; i < n; i++) {
                if (leftBigger[i] != INF) max = Math.max(max, arr[i] ^ leftBigger[i]);
                if (rightBigger[i] != INF) max = Math.max(max, arr[i] ^ rightBigger[i]);
            }
            out.println(max);
       
        }
    }
    static long GCD(long a, long b) { return (a%b == 0)? Math.abs(b) : GCD(b,a%b); }
    static long ncr(long n,long r){
        if(r==0 || r==n) return 1;
        double d=1;
        if(r>n) r=n-r;
        for(int i=0;i<r;i++){
            d*=(double)(n-i)/(i+1);

        }
        return (long)d;
    }
    static long d, x, y;
    static void extendedEuclid(long A, long B) {
        if(B == 0) {
            d = A;
            x = 1;
            y = 0;
        }
        else {
            extendedEuclid(B, A%B);
            long temp = x;
            x = y;
            y = temp - (A/B)*y;
        }
    }
    static long modInverse(long A, long M)
    {
        extendedEuclid(A,M);
        return (x%M+M)%M;
    }
    static long modPow(long x,long y,long M){
        if(y==0) return 1;
        if(y%2==0) return modPow((x*x)%M,y/2,M);
        else return (x*modPow((x*x)%M,(y-1)/2,M))%M;
    }
    static long M = (long) Math.pow(10,9)+7;
    static long fact(long x){
        if(x==0 || x==1) return 1;
        return ((x%M) * (fact(x-1)%M))%M;
    }
    static long power(long x,long y){
        if(y==0) return 1;
        if(y%2==0) return power((x*x)%M,y/2)%M;
        else return (x*power((x*x)%M,(y-1)/2))%M;
    }
    //MY CODE END HERE//

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }
        private String readLine0(){
            StringBuilder buf = new StringBuilder ();
            int c = read ();
            while (c != '\n' && c != -1){
                if (c != '\r'){
                    buf.appendCodePoint (c);
                }
                c = read ();
            }
            return buf.toString ();
        }
        public String nextLine(){
            String s = readLine0 ();
            while (s.trim ().length () == 0)
                s = readLine0 ();
            return s;
        }
        public String nextLine(boolean ignoreEmptyLines){
            if (ignoreEmptyLines){
                return nextLine ();
            }else{
                return readLine0 ();
            }
        }
        public char nextCharacter(){
            int c = read ();
            while (isSpaceChar (c))
                c = read ();
            return (char) c;
        }

        public double nextDouble(){
            int c = read ();
            while (isSpaceChar (c))
                c = read ();
            int sgn = 1;
            if (c == '-'){
                sgn = -1;
                c = read ();
            }
            double res = 0;
            while (!isSpaceChar (c) && c != '.'){
                if (c == 'e' || c == 'E'){
                    return res * Math.pow (10, nextInt ());
                }
                if (c < '0' || c > '9'){
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read ();
            }
            if (c == '.'){
                c = read ();
                double m = 1;
                while (!isSpaceChar (c)){
                    if (c == 'e' || c == 'E'){
                        return res * Math.pow (10, nextInt ());
                    }
                    if (c < '0' || c > '9'){
                        throw new InputMismatchException ();
                    }
                    m /= 10;
                    res += (c - '0') * m;
                    c = read ();
                }
            }
            return res * sgn;
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = read();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
        public String next() {
            return nextString();
        }
        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }
        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
        public String nextString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
        public BigInteger nextBigInteger(){
            try{
                return new BigInteger (nextString());
            } catch (NumberFormatException e){
                throw new InputMismatchException ();
            }
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }


    }
}