#include <bits/stdc++.h>
using namespace std;
int i, j, n, r, x, ans;
int s[100005];
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &x);
    while (r && s[r] <= x) ans = max(ans, x ^ s[r]), r--;
    s[++r] = x;
    if (r > 1) ans = max(ans, s[r] ^ s[r - 1]);
  }
  printf("%d\n", ans);
  return 0;
}
