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;
struct node {
  node *a[2];
  int cc;
  int val;
  node() {
    val = -1;
    a[0] = a[1] = NULL;
    cc = 0;
  }
};
void rem(node &on, int dep, int num) {
  on.cc--;
  if (dep == -1) {
    on.val = -1;
    return;
  }
  bool ox = ((num & (1 << dep)) != 0);
  rem(*on.a[ox], dep - 1, num);
}
void put(node &on, int dep, int num) {
  on.cc++;
  if (dep == -1) {
    on.val = num;
    return;
  }
  bool ox = ((num & (1 << dep)) != 0);
  if (on.a[ox] == NULL) on.a[ox] = new node();
  put(*on.a[ox], dep - 1, num);
}
bool chk(node *on) {
  if (on == NULL) return 0;
  if (on->cc == 0) return 0;
  return 1;
}
int ar[2][2] = {1, 0, 0, 1};
int get(node &on, int dep, int num, bool equal) {
  if (equal == 1 && dep == -1) assert(0);
  if (dep == -1) {
    assert(on.val != -1);
    return on.val;
  }
  int ox = ((num & (1 << dep)) != 0);
  if (equal) {
    for (int x = (0); x < int(2); x += 1) {
      int i = ar[ox][x];
      if (i > ox) continue;
      if (!chk(on.a[i])) continue;
      int rr = get(*on.a[i], dep - 1, num, i == ox);
      if (rr != -1) return rr;
    }
    return -1;
  } else {
    for (int x = (0); x < int(2); x += 1) {
      int i = ar[ox][x];
      if (!chk(on.a[i])) continue;
      int rr = get(*on.a[i], dep - 1, num, 0);
      if (rr != -1) return rr;
    }
    return -1;
  }
}
node *rot;
int solve(vector<int> in) {
  rot = new node();
  vector<int> xx;
  xx.push_back(in[0]);
  put(*rot, 30, in[0]);
  int ret = 0;
  for (int i = (1); i < int(in.size()); i += 1) {
    int z = get(*rot, 30, in[i], 1);
    if (z != -1) ret = max(ret, z ^ in[i]);
    while (xx.size() && xx.back() < in[i]) {
      rem(*rot, 30, xx.back());
      xx.pop_back();
    }
    if (xx.size() == 0 || xx.back() > in[i])
      put(*rot, 30, in[i]), xx.push_back(in[i]);
  }
  return ret;
}
int main() {
  int n;
  cin >> n;
  vector<int> in(n);
  for (int i = (0); i < int(n); i += 1) cin >> in[i];
  int a = solve(in);
  reverse(in.begin(), in.end());
  int b = solve(in);
  cout << max(a, b);
  return 0;
}
