#include <bits/stdc++.h>
using namespace std;
int a[100005], b[100005], q[100005];
int n, qw, ans;
int func(int* arr) {
  int ret = 0;
  qw = 0;
  q[qw++] = 0x7fffffff;
  for (int i = 0; i < n; i++) {
    while (q[qw - 1] < arr[i]) qw--;
    if (qw != 1) ret = max(ret, q[qw - 1] ^ arr[i]);
    q[qw++] = arr[i];
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) b[i] = a[n - i - 1];
  ans = func(a);
  ans = max(ans, func(b));
  printf("%d\n", ans);
  return 0;
}
