#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n;
int a[N], s[N];
int solve() {
  int top = 0, i, ret = 0;
  for (i = 0; i < n; i++) {
    while (top && a[s[top]] <= a[i]) top--;
    if (top) ret = max(ret, a[i] ^ a[s[top]]);
    s[++top] = i;
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  int ret = solve();
  reverse(a, a + n);
  ret = max(ret, solve());
  printf("%d\n", ret);
  return 0;
}
