#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000010;
const int maxm = 2000010;
const int INF = 1e9;
const int mod = 1e9 + 7;
int n, m;
int a[maxn];
int l[maxn];
int r[maxn];
int main() {
  int i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  a[0] = a[n + 1] = 0;
  l[0] = r[0] = l[n + 1] = r[n + 1] = 0;
  for (i = 1; i <= n; i++) {
    l[i] = i;
    while (l[i] > 1 && a[i] > a[l[i] - 1]) {
      l[i] = l[l[i] - 1];
    }
  }
  for (i = n; i > 0; i--) {
    r[i] = i;
    while (r[i] < n && a[i] > a[r[i] + 1]) {
      r[i] = r[r[i] + 1];
    }
  }
  int ans = 0;
  for (i = 1; i <= n; i++) {
    int temp = 0;
    if (a[l[i] - 1] > a[i]) temp = a[l[i] - 1];
    if (l[i] - 1 > 0) ans = max(ans, temp ^ a[i]);
    temp = 0;
    if (a[r[i] + 1] > a[i]) temp = a[r[i] + 1];
    if (r[i] + 1 <= n) ans = max(ans, temp ^ a[i]);
  }
  printf("%d\n", ans);
  return 0;
}
