#include <bits/stdc++.h>
using namespace std;
int n;
int a[100010];
int s[100010];
int solve() {
  int ret = 0, top = 0;
  for (int i = 0; i < n; i++) {
    while (top && a[s[top]] < a[i]) --top;
    if (top) ret = max(ret, a[s[top]] ^ a[i]);
    s[++top] = i;
  }
  return ret;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  reverse(a, a + n);
  int ans = solve();
  reverse(a, a + n);
  ans = max(ans, solve());
  cout << ans << endl;
  return 0;
}
