#include <bits/stdc++.h>
using namespace std;
int ans, a[100005], l[100005], r[100005];
int main() {
  int T, i, j, k, ca = 0, n, x, y, b;
  while (~scanf("%d", &n)) {
    for (i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    l[1] = 1;
    for (i = 2; i <= n; i++) {
      x = i - 1;
      while (x > 1 && a[i] > a[x]) x = l[x];
      l[i] = x;
    }
    r[n] = n;
    for (i = n - 1; i >= 1; i--) {
      x = i + 1;
      while (x < n && a[i] > a[x]) x = r[x];
      r[i] = x;
    }
    ans = 0;
    for (i = 1; i <= n; i++) {
      if (a[l[i]] > a[i]) ans = max(ans, a[i] ^ a[l[i]]);
      if (a[r[i]] > a[i]) ans = max(ans, a[i] ^ a[r[i]]);
    }
    printf("%d\n", ans);
  }
  return 0;
}
