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;
long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }
int toInt(char xx) { return xx - '0'; }
char toChar(int xx) { return xx + '0'; }
int isDigit(char xx) { return ('0' <= xx && xx <= '9'); }
bool isCharacter(char xx) {
  return (('a' <= xx && xx <= 'z') || ('A' <= xx && xx <= 'Z'));
}
void swapInt(int &x, int &y) {
  x = x ^ y;
  y = x ^ y;
  x = x ^ y;
}
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const int Mod = 9901;
const int maxn = 1e5 + 10;
int exitInput = 0;
int n, L[maxn], it[4 * maxn + 4];
long long a[maxn];
void build_it(int node, int l, int r) {
  if (l == r) {
    it[node] = l;
    return;
  }
  int mid = (l + r) >> 1;
  build_it((node << 1), l, mid);
  build_it((node << 1) | 1, mid + 1, r);
  if (a[it[(node << 1)]] > a[it[(node << 1) | 1]]) {
    it[node] = it[(node << 1)];
  } else {
    it[node] = it[(node << 1) | 1];
  }
}
int query(int node, int l, int r, int i, int j) {
  if (r < i || j < l) {
    return -1;
  }
  if (i <= l && r <= j) {
    return it[node];
  }
  int mid = (l + r) >> 1;
  int p1 = query((node << 1), l, mid, i, j);
  int p2 = query((node << 1) | 1, mid + 1, r, i, j);
  if (p1 == -1) return p2;
  if (p2 == -1) return p1;
  if (a[p1] > a[p2]) {
    return p1;
  } else {
    return p2;
  }
}
int bsearch(int i) {
  int lo = 1, hi = i - 1, mid, idx, res = 0;
  while (lo <= hi) {
    mid = (lo + hi) >> 1;
    idx = query(1, 1, n, mid, i - 1);
    if (a[idx] > a[i]) {
      res = idx;
      lo = mid + 1;
    } else {
      hi = mid - 1;
    }
  }
  return res;
}
void read() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
}
void init() {
  build_it(1, 1, n);
  int i, idx;
  L[1] = 0;
  for (i = 2; i <= n; ++i) {
    L[i] = bsearch(i);
  }
}
void solve() {
  if (n == 2) {
    cout << (a[1] ^ a[2]) << endl;
    return;
  }
  long long res = 0;
  int i, j;
  for (i = 2; i + 1 <= n; ++i) {
    res = max(res, a[i] ^ a[i + 1]);
    res = max(res, a[i] ^ a[i - 1]);
  }
  for (i = 2; i <= n; ++i) {
    j = i - 1;
    for (;;) {
      j = L[j];
      if (j == 0 || a[j] > a[i]) break;
      res = max(res, a[i] ^ a[j]);
    }
  }
  reverse(a + 1, a + n + 1);
  build_it(1, 1, n);
  L[1] = 0;
  for (i = 2; i <= n; ++i) {
    L[i] = bsearch(i);
  }
  for (i = 2; i <= n; ++i) {
    j = i - 1;
    for (;;) {
      j = L[j];
      if (j == 0 || a[j] > a[i]) break;
      res = max(res, a[i] ^ a[j]);
    }
  }
  cout << res << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  int ntest = 1;
  int itest = 1;
  for (itest = 1; itest <= ntest; ++itest) {
    read();
    if (exitInput) {
      break;
    }
    if (itest > 1) {
    }
    init();
    solve();
  }
  return 0;
}
