#include <bits/stdc++.h>
using namespace std;
const long long maxn = 300909;
const long long maxN = 2e6 + 7;
const long long oo = UINT_MAX;
const long long mod = 1e9 + 7;
long long n, a[maxn];
stack<long long> st;
long long ans = 0;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n; i++) {
    if (st.empty()) {
      st.push(a[i]);
      continue;
    }
    while (!st.empty() && st.top() < a[i]) {
      ans = max(ans, a[i] ^ st.top());
      st.pop();
    }
    st.push(a[i]);
  }
  while (!st.empty()) st.pop();
  for (long long i = n; i >= 1; i--) {
    if (st.empty()) {
      st.push(a[i]);
      continue;
    }
    while (!st.empty() && st.top() < a[i]) {
      ans = max(ans, a[i] ^ st.top());
      st.pop();
    }
    st.push(a[i]);
  }
  cout << ans;
}
