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}.
#include <bits/stdc++.h>
using namespace std;
bool prime[1000000];
void seive_of_prime() {
  memset(prime, 1, sizeof(prime));
  prime[0] = 0;
  prime[1] = 0;
  int i = 2;
  while (i <= 1000000) {
    if (prime[i] != 0) {
      for (int j = i + i; j <= 1000000; j += i) {
        prime[j] = 0;
      }
    }
    i++;
  }
}
void prime_factor(long long n) {
  int x = 2;
  while (n != 1) {
    if (n % x == 0) {
      cout << x << ' ';
      n /= x;
    } else {
      x++;
    }
  }
}
bool divisor(long long int n) {
  int c1 = 0;
  for (int i = 1; i <= sqrt(n) + 1; i++) {
    if (n % i == 0) {
      if (i == n / i) {
        c1++;
      } else {
        c1 += 2;
      }
    }
  }
  if (c1 == 2) {
    return true;
  } else {
    return false;
  }
}
long long gcd(long long a, long long b) {
  if (a == 0) {
    return b;
  }
  if (b == 0) {
    return a;
  }
  if (a == b) {
    return a;
  }
  if (a > b) {
    return gcd((a - (a / b) * b), b);
  } else {
    return gcd((b - (b / a) * a), a);
  }
}
long long power(long long base, long long exp) {
  long long res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) {
      res = (res * base) % 1000000007;
    }
    base = (base * base) % 1000000007;
    exp /= 2;
  }
  return res % 1000000007;
}
long long powe(long long x, long long y) {
  if (y == 0) {
    return 1;
  }
  if (y == 1) {
    return x;
  } else if (y % 2 == 0) {
    long long x1 = powe(x, (long long)y / 2);
    long long t1 = (long long)(x1 * x1);
    if (t1 >= 1000000007) {
      return t1 % 1000000007;
    } else {
      return t1;
    }
  } else {
    long long x1 = powe(x, (long long)((y - 1) / 2));
    long long t1 = (long long)(((long long)(x1 * x1)) % 1000000007) * x;
    if (t1 >= 1000000007) {
      return t1 % 1000000007;
    } else {
      return t1;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  ;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  stack<long long> st;
  st.push(a[0]);
  long long max = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] < st.top()) {
      long long temp = a[i] ^ st.top();
      if (temp > max) {
        max = temp;
      }
      st.push(a[i]);
    } else {
      while ((!st.empty()) && a[i] > st.top()) {
        long long temp = a[i] ^ st.top();
        if (temp > max) {
          max = temp;
        }
        st.pop();
      }
      if (!st.empty()) {
        long long temp = a[i] ^ st.top();
        if (temp > max) {
          max = temp;
        }
      }
      st.push(a[i]);
    }
  }
  cout << max;
  return 0;
}
