#include <bits/stdc++.h>
using namespace std;
const int Maxn = 5e5 + 7;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
int read() {
  int x = 0, f = 1;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + s - '0';
    s = getchar();
  }
  return x * f;
}
int n, x;
int st;
int stk[Maxn];
int ans;
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    x = read();
    while (st >= 1) {
      ans = max(ans, stk[st] ^ x);
      if (stk[st] > x) break;
      st--;
    }
    stk[++st] = x;
  }
  cout << ans << endl;
}
