#include <bits/stdc++.h>
using namespace std;
const int maxn = 100007;
int n;
int a[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int res = 0;
  stack<int> zz;
  zz.push(a[1]);
  for (int i = 2; i <= n; i++) {
    while (zz.size() && a[i] > zz.top()) {
      res = max(res, a[i] ^ zz.top());
      zz.pop();
    }
    if (zz.size()) res = max(res, a[i] ^ zz.top());
    zz.push(a[i]);
  }
  printf("%d\n", res);
  return 0;
}
