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 t, n, i, j, k, x, y, z, l, r, mid, mod = 1e9 + 7, g, m, ans;
long long a[400005], b[400005], c[400005], d[200005];
char ch;
string s, st;
vector<long long> v[300005], u;
struct nd {
  long long nx[2], fr, num;
  nd() {
    nx[0] = nx[1] = -1;
    fr = num = 0;
  }
};
vector<nd> tr;
bool ok(long long x) {
  long long cur = 0, d;
  for (int i = 31; i >= 0; i--) {
    d = (x >> i) & 1;
    if (tr[cur].nx[d] == -1) return 0;
    if (tr[tr[cur].nx[d]].fr <= 0) return 0;
    cur = tr[cur].nx[d];
  }
  return 1;
}
void add(long long x) {
  if (ok(x)) return;
  int cur = 0, d;
  for (int i = 31; i >= 0; i--) {
    d = (x >> i) & 1;
    if (tr[cur].nx[d] == -1) tr.push_back(nd()), tr[cur].nx[d] = tr.size() - 1;
    cur = tr[cur].nx[d], tr[cur].fr++;
  }
  tr[cur].num = x;
}
void del(long long x) {
  if (!ok(x)) return;
  long long cur = 0, d;
  for (int i = 31; i >= 0; i--)
    d = (x >> i) & 1, cur = tr[cur].nx[d], tr[cur].fr--;
}
long long mx(long long x) {
  long long cur = 0, d, ans = 0;
  for (int i = 31; i >= 0; i--) {
    d = (x >> i) & 1;
    if (tr[cur].nx[1 ^ d] != -1 && tr[tr[cur].nx[1 ^ d]].fr > 0) {
      ans |= (1 << i);
      cur = tr[cur].nx[1 ^ d];
    } else
      cur = tr[cur].nx[d];
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  tr.push_back(nd());
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 30; i >= 0; i--) {
    x = 0;
    for (j = 0; j < n; j++) x += ((a[j] >> i) & 1);
    if (x < n && x > 0) break;
  }
  if (i < 0) return cout << 0, 0;
  for (j = 0; j < n; j++) b[j] = ((a[j] >> i) & 1);
  x = 0;
  for (i = 0; i < n; i++)
    if (b[i])
      x = 0;
    else {
      x = max(x, a[i]);
      c[i] = x;
    }
  x = 0;
  for (i = n - 1; i >= 0; i--)
    if (b[i])
      x = 0;
    else {
      x = max(x, a[i]);
      d[i] = x;
    }
  for (i = 0; i < n; i++)
    if (b[i]) {
      for (j = i - 1; j >= 0 && b[j] == 0; j--) add(d[j]);
      for (j = i + 1; j < n && b[j] == 0; j++) add(c[j]);
      add(a[i]);
      ans = max(ans, mx(a[i]));
      for (j = i - 1; j >= 0 && b[j] == 0; j--) del(d[j]);
      for (j = i + 1; j < n && b[j] == 0; j++) del(c[j]);
      del(a[i]);
    }
  cout << ans;
}
