#include <bits/stdc++.h>
using namespace std;
const long long LLMAX = 0x7fffffffffffffffLL;
const long long LLMIN = 0x8000000000000000LL;
const int IMAX = 0x7fffffff;
const int IMIN = 0x80000000;
const double eps = 10e-7;
const int maxn = 100000 + 10;
int n;
int num[maxn], L[maxn], R[maxn];
const int maxnum = 1000000001;
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &num[i]);
      L[i] = R[i] = i;
    }
    num[0] = num[n + 1] = maxnum;
    L[0] = R[n + 1] = -1;
    for (int i = 1; i <= n; i++) {
      while (num[L[i] - 1] < num[i]) L[i] = L[L[i] - 1];
    }
    for (int i = n; i >= 1; i--) {
      while (num[R[i] + 1] < num[i]) R[i] = R[R[i] + 1];
    }
    int ans = (num[1] ^ num[2]);
    for (int i = 1; i <= n; i++) {
      if (L[i] - 1 >= 1) ans = max(ans, num[i] ^ num[L[i] - 1]);
      if (R[i] + 1 <= n) ans = max(ans, num[i] ^ num[R[i] + 1]);
    }
    printf("%d\n", ans);
  }
  return 0;
}
