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;
int a[100005], lg[100005];
int rmq[100005][20];
struct trie {
  struct node {
    node *edge[2];
    vector<int> ps[2];
    node() {
      for (int i = 0; i < 2; i++) edge[i] = 0;
      ps[0].clear();
      ps[1].clear();
    }
  } * root;
  trie() { root = new node(); }
  void insert(int v, int p) {
    node *t = root;
    for (int po = 29; po >= 0; po--) {
      int x = (bool)(v & (1 << po));
      if (!t->edge[x]) t->edge[x] = new node();
      t->ps[x].push_back(p);
      t = t->edge[x];
    }
  }
  void remove(int v) {
    node *t = root;
    for (int po = 29; po >= 0; po--) {
      int x = (bool)(v & (1 << po));
      t->ps[x].pop_back();
      t = t->edge[x];
    }
  }
  long long query(int v, int last) {
    node *t = root;
    int res = 0;
    for (int po = 29; po >= 0; po--) {
      int x = (bool)(v & (1 << po));
      x = !x;
      if (!t->ps[x].empty() && t->ps[x].back() > last) {
        res += (1 << po);
        t = t->edge[x];
      } else
        t = t->edge[!x];
    }
    return res;
  }
};
int q(int l, int r) {
  if (l > r) swap(l, r);
  int po = lg[r - l + 1];
  return max(rmq[l][po], rmq[r - (1 << po) + 1][po]);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  lg[0] = -1;
  for (int i = 1; i < 100005; i++) lg[i] = lg[i - 1] + !(i & (i - 1));
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) rmq[i][0] = a[i];
  for (int i = 1; i <= lg[n]; i++)
    for (int j = 0; j + (1 << i) <= n; j++)
      rmq[j][i] = max(rmq[j][i - 1], rmq[j + (1 << (i - 1))][i - 1]);
  long long res = 0;
  trie t;
  t.insert(a[0], 0);
  stack<pair<long long, long long> > ms;
  ms.push(pair<long long, long long>(a[0], 0));
  for (int i = 1; i < n; i++) {
    int p1 = -1;
    for (int po = (1 << 17); po; po >>= 1)
      if (p1 + po < i && q(p1 + po, i) > a[i]) p1 += po;
    int p2 = -1;
    if (p1 > 0)
      for (int po = (1 << 17); po; po >>= 1)
        if (p2 + po <= p1 - 1 && q(p2 + po, p1 - 1) > a[i]) p2 += po;
    res = max(res, t.query(a[i], p2));
    while (!ms.empty() && ms.top().second > p1) {
      t.remove(ms.top().first);
      ms.pop();
    }
    t.insert(a[i], i);
    ms.push(pair<long long, long long>(a[i], i));
  }
  cout << (res) << '\n';
  return 0;
}
