#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1e5 + 9;
int a[Maxn];
int stk[Maxn], top;
int ans;
int n;
void update() {
  top = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = top; j >= 1; --j) {
      if (a[stk[j]] < a[i]) {
        ans = max(ans, a[i] ^ a[stk[j]]);
      } else
        break;
    }
    while (top != 0 && a[stk[top]] < a[i]) top--;
    stk[++top] = i;
  }
}
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
    ans = 0;
    update();
    reverse(a + 1, a + 1 + n);
    update();
    cout << ans << endl;
  }
  return 0;
}
