#include <bits/stdc++.h>
using namespace std;
int a[100000];
int main() {
  int n, v, ans = 0, top = -1;
  scanf("%d", &n);
  while (n--) {
    scanf("%d", &v);
    while (top != -1 && a[top] < v) ans = max(ans, v ^ a[top--]);
    if (top != -1) ans = max(ans, v ^ a[top]);
    a[++top] = v;
  }
  printf("%d\n", ans);
  return 0;
}
