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

public class D {
     public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for(int i=0;i<n;i++)arr[i] = sc.nextInt();
        SparseTable st = new SparseTable(arr,3);
        int result = 0;
        for(int i=0;i<n-1;i++){
            // binary search
            int a = i+1;
            int b = n-1;
            int mid = 0;
            int res = -1;
            while (a<=b){
                mid = a+(b-a)/2;
                //System.out.println(i+" " +mid + " " + arr[mid]);
                if(st.query(a,mid)>arr[i]){
                    res = mid;
                    b = mid-1;
                }else{
                    a = mid+1;
                }
            }
            if(res == -1)continue;
           // System.out.print(arr[res]+ " ");
            result = Math.max(arr[res]^arr[i],result);
        }
        for(int i=n-1;i>0;i--){
            int a = 0;
            int b = i-1;
            int mid = 0;
            int res = -1;
            while (a<=b){
                mid = a+(b-a)/2;
                if(st.query(mid,b)>arr[i]){
                    res = mid;
                    a = mid+1;
                }else b = mid-1;
            }
            if(res==-1)continue;
            result = Math.max(arr[i]^arr[res],result);
        }
        pw.println(result);
        pw.flush();
        pw.close();
    }
    static class SparseTable {
        int A[], SpT[][];
        int opval = 1;
        // opval =1 => min , opval = 2 => gcd
        static int gcd(int a, int b) {
            if (a == 0)
                return b;
            return gcd(b % a, a);
        }
        int f(int a,int b){
            if(opval==1)
                return Math.min(a,b);
            else if (opval==2)
                return gcd(a,b);
            else if(opval==3)return Math.max(a,b);
            return 0;
        }
        SparseTable(int[] A,int opval) {
            this.opval =opval;
            int n = A.length;	this.A = A;
            int k = (int)Math.floor(Math.log(n) / Math.log(2)) + 1;
            SpT = new int[n][k];

            for (int i = 0; i < n; i++)
                SpT[i][0] = A[i]; 					// RMQ of sub array starting at index i and of length 2^0=1

            //overall time complexity = O(n log n)
            for (int j = 1; (1<<j) <= n; j++) {
                for (int i = 0; i + (1 << j) - 1 < n; i++)
                    SpT[i][j] = f(SpT[i][j - 1], SpT[i + (1 << (j-1))][j - 1]);
            }
        }
        int query(int i, int j) {
            if(i==j)return SpT[i][0];
            int k = 0;
            while((1<<k)<j-i+1){
                k++;
            }
            if((1<<k)>j-i+1)k--;
            return f(SpT[i][k],SpT[j-(1<<k)+1][k]);
        }
        void print(){
            for(int i=0;i<SpT[0].length;i++){
                for(int j=0;j<SpT.length;j++)
                    System.out.print(SpT[j][i] + " ");
                System.out.println();
            }
        }
    }
    static class FenwickTree { // one-based DS

        int n;
        int[] ft;

        FenwickTree(int size) { n = size; ft = new int[n+1]; }

        int rsq(int b) //O(log n)
        {
            int sum = 0;
            while(b > 0) { sum += ft[b]; b -= b & -b;}		//min?
            return sum;
        }

        int rsq(int a, int b) { return rsq(b) - rsq(a-1); }

        void point_update(int k, int val)	//O(log n), update = increment
        {
            while(k <= n) { ft[k] += val; k += k & -k; }		//min?
        }
        int get(int v){
            int sum =0;
            int id=0;
            for (int i =22;i>=0;i--){
                if (id+(1<<i)>n)
                    continue;
                if (sum+ft[id+(1<<i)]<v){
                    id+=(1<<i);
                    sum+=ft[id];
                }
            }
            return id+1;
        }
        public int findKthmin(int k){
            int a = 1;
            int b = n;
            int mid = 0;
            int res= 1;
            while (a<=b){
                mid = (a+b)/2;
                if(this.rsq(mid)>=k){
                    res =mid;
                    b = mid-1;
                }else{
                    a = mid+1;
                }
            }
            return res;
        }
    }
    static class Pair implements Comparable<Pair>{
        int x;
        int y;
        public Pair(int x,int y){
            this.x= x;
            this.y = y;
        }
        public int compareTo(Pair p){
            if(this.x==p.x)
                return Long.compare(this.y,p.y);
            return -Long.compare(this.x,p.x);
        }
        public String toString(){
            return x+ " " + y;
        }
    }
    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();

        }
    }
}