#include <bits/stdc++.h>
using namespace std;
bool test_cases;
void init(bool k) {
  test_cases = k;
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
struct test_cases {
  void prepare_left(long long *great_left, long long n, long long *a) {
    stack<long long> st;
    great_left[0] = -1;
    st.push(a[0]);
    for (long long i = 1; i < n; i++) {
      while (!st.empty() and st.top() < a[i]) {
        st.pop();
      }
      if (st.empty()) {
        great_left[i] = -1;
      } else {
        great_left[i] = st.top();
      }
      st.push(a[i]);
    }
  }
  void prepare_right(long long *great_right, long long n, long long *a) {
    stack<long long> st;
    great_right[n - 1] = -1;
    st.push(a[n - 1]);
    for (long long i = n - 2; i >= 0; i--) {
      while (!st.empty() and st.top() < a[i]) {
        st.pop();
      }
      if (st.empty()) {
        great_right[i] = -1;
      } else {
        great_right[i] = st.top();
      }
      st.push(a[i]);
    }
  }
  void test_case(long long test) {
    long long n;
    cin >> n;
    long long a[n];
    long long great_left[n];
    long long great_right[n];
    for (long long i = 0; i < n; i++) cin >> a[i];
    long long ans = 0;
    for (long long i = 0; i < n - 1; i++) {
      ans = max(ans, a[i] ^ a[i + 1]);
    }
    prepare_left(great_left, n, a);
    prepare_right(great_right, n, a);
    for (long long i = 0; i < n; i++) {
      long long left = great_left[i];
      long long right = great_right[i];
      if (left != -1) {
        ans = max(ans, left ^ a[i]);
      }
      if (right != -1) {
        ans = max(ans, right ^ a[i]);
      }
      if (left != -1 and right != -1) {
        ans = max(ans, left ^ right);
      }
    }
    cout << ans << "\n";
  }
};
int32_t main() {
  init(false);
  long long tc;
  if (test_cases) {
    cin >> tc;
  } else {
    tc = 1;
  }
  for (long long i = 0; i < tc; i++) {
    struct test_cases o;
    o.test_case(i + 1);
  }
  return 0;
};

### Prompt

Construct a CPP code solution to the problem outlined:

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}.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
bool test_cases;
void init(bool k) {
  test_cases = k;
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
struct test_cases {
  void prepare_left(long long *great_left, long long n, long long *a) {
    stack<long long> st;
    great_left[0] = -1;
    st.push(a[0]);
    for (long long i = 1; i < n; i++) {
      while (!st.empty() and st.top() < a[i]) {
        st.pop();
      }
      if (st.empty()) {
        great_left[i] = -1;
      } else {
        great_left[i] = st.top();
      }
      st.push(a[i]);
    }
  }
  void prepare_right(long long *great_right, long long n, long long *a) {
    stack<long long> st;
    great_right[n - 1] = -1;
    st.push(a[n - 1]);
    for (long long i = n - 2; i >= 0; i--) {
      while (!st.empty() and st.top() < a[i]) {
        st.pop();
      }
      if (st.empty()) {
        great_right[i] = -1;
      } else {
        great_right[i] = st.top();
      }
      st.push(a[i]);
    }
  }
  void test_case(long long test) {
    long long n;
    cin >> n;
    long long a[n];
    long long great_left[n];
    long long great_right[n];
    for (long long i = 0; i < n; i++) cin >> a[i];
    long long ans = 0;
    for (long long i = 0; i < n - 1; i++) {
      ans = max(ans, a[i] ^ a[i + 1]);
    }
    prepare_left(great_left, n, a);
    prepare_right(great_right, n, a);
    for (long long i = 0; i < n; i++) {
      long long left = great_left[i];
      long long right = great_right[i];
      if (left != -1) {
        ans = max(ans, left ^ a[i]);
      }
      if (right != -1) {
        ans = max(ans, right ^ a[i]);
      }
      if (left != -1 and right != -1) {
        ans = max(ans, left ^ right);
      }
    }
    cout << ans << "\n";
  }
};
int32_t main() {
  init(false);
  long long tc;
  if (test_cases) {
    cin >> tc;
  } else {
    tc = 1;
  }
  for (long long i = 0; i < tc; i++) {
    struct test_cases o;
    o.test_case(i + 1);
  }
  return 0;
};

```