#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)6e5 + 7;
int a[MAXN], mx[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  stack<int> S;
  for (int i = 0; i < n; i++) {
    while (!S.empty() and a[S.top()] < a[i]) {
      mx[i] = max(mx[i], (a[i] ^ a[S.top()]));
      S.pop();
    }
    S.push(i);
  }
  stack<int> T;
  for (int i = n - 1; i >= 0; i--) {
    while (!T.empty() and a[T.top()] < a[i]) {
      mx[i] = max(mx[i], (a[i] ^ a[T.top()]));
      T.pop();
    }
    T.push(i);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) ans = max(ans, mx[i]);
  cout << ans;
}
