#include <bits/stdc++.h>
int Max(int a, int b) { return a > b ? a : b; }
int const N = 100100;
int s[N], top, num, n;
int main() {
  while (~scanf("%d", &n)) {
    scanf("%d", &s[1]), top = 1, n--;
    int answer = 0;
    while (n--) {
      scanf("%d", &num);
      while (top != 0 && num > s[top]) {
        answer = Max(answer, s[top] ^ num);
        top--;
      }
      if (top != 0) answer = Max(answer, s[top] ^ num);
      s[++top] = num;
    }
    printf("%d\n", answer);
  }
  return 0;
}
