#include <bits/stdc++.h>
using namespace std;
const int MOD(1000000007);
const int INF((1 << 30) - 1);
const int MAXN(100005);
int a[MAXN], q[MAXN], bk = 0;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  q[bk++] = a[0];
  int ans = 0;
  for (int i = 1; i <= n - 1; i++) {
    while (bk > 0 && q[bk - 1] <= a[i]) {
      ans = max(ans, a[i] ^ q[bk - 1]);
      bk--;
    }
    if (bk > 0) ans = max(ans, a[i] ^ q[bk - 1]);
    q[bk++] = a[i];
  }
  printf("%d", ans);
}
