#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int a[maxn], L[maxn], R[maxn];
int main(int argc, char const *argv[]) {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  stack<int> st;
  for (int i = 1; i <= n; ++i) {
    while (!st.empty() && a[st.top()] < a[i]) {
      st.pop();
    }
    if (st.empty()) {
      L[i] = -1;
    } else {
      L[i] = st.top();
    }
    st.push(i);
  }
  while (!st.empty()) st.pop();
  for (int i = n; i >= 1; --i) {
    while (!st.empty() && a[st.top()] < a[i]) {
      st.pop();
    }
    if (st.empty()) {
      R[i] = -1;
    } else {
      R[i] = st.top();
    }
    st.push(i);
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (L[i] != -1) {
      ans = max(ans, a[i] ^ a[L[i]]);
    }
    if (R[i] != -1) {
      ans = max(ans, a[i] ^ a[R[i]]);
    }
  }
  cout << ans << endl;
  return 0;
}
