#include <bits/stdc++.h>
using namespace std;
int a[111111];
int n;
int main() {
  scanf("%d", &n);
  int an = 0, e = 0;
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    while (e > 0) {
      an = max(an, x ^ a[e]);
      if (x > a[e])
        --e;
      else
        break;
    }
    a[++e] = x;
  }
  printf("%d", an);
  return 0;
}
