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