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