#include <bits/stdc++.h>
#pragma comment(linker, "/stack:16777216")
using namespace std;
const int INF = 1 << 30;
const int MAX = 1 << 17;
int n;
int A[MAX];
int L[MAX];
int R[MAX];
int main() {
  cin >> n;
  for (int i = (0); i < (n); ++i) scanf("%d", &A[i]);
  L[0] = -1;
  for (int i = (1); i < (n); ++i) {
    int j = i - 1;
    while (j >= 0 && A[j] <= A[i]) j = L[j];
    L[i] = j;
  }
  R[n - 1] = n;
  for (int i = n - 2; i >= 0; i--) {
    int j = i + 1;
    while (j < n && A[j] <= A[i]) j = R[j];
    R[i] = j;
  }
  int res = 0;
  for (int i = (0); i < (n); ++i) {
    if (L[i] != -1) res = max(res, A[i] ^ A[L[i]]);
    if (R[i] != n) res = max(res, A[i] ^ A[R[i]]);
  }
  cout << res << endl;
  return 0;
}
