#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int s[N][20], a[N], ans;
int get(int l, int r) {
  int len = r - l + 1, j = log2(len);
  len = 1 << j;
  return max(s[l][j], s[r - len + 1][j]);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    s[i][0] = a[i];
  }
  for (int j = 1; j < 20; j++) {
    int len = 1 << j;
    for (int i = 0; i + len - 1 < n; i++)
      s[i][j] = max(s[i][j - 1], s[i + len / 2][j - 1]);
  }
  for (int i = 0; i < n; i++) {
    int cur = i;
    for (int j = 20; j >= 0; j--) {
      int len = 1 << j;
      if (cur - len < 0) continue;
      if (s[cur - len][j] <= a[i]) cur -= len;
    }
    if (cur) ans = max(ans, a[i] ^ a[cur - 1]);
    cur = i;
    for (int j = 20; j >= 0; j--) {
      int len = 1 << j;
      if (cur + len >= n) continue;
      if (s[cur + 1][j] <= a[i]) cur += len;
    }
    if (cur + 1 < n) ans = max(ans, a[i] ^ a[cur + 1]);
  }
  printf("%d", ans);
  return 0;
}
