#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const double pi = acos(-1.0);
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
template <class T>
inline void CLR(priority_queue<T, vector<T>, greater<T> > &Q) {
  while (!Q.empty()) Q.pop();
}
inline int random(int l, int r) { return rand() % (r - l + 1) + l; }
int dir_4[4][2] = {{0, 1}, {-1, 0}, {0, -1}, {1, 0}};
int dir_8[8][2] = {{0, 1},  {-1, 1}, {-1, 0}, {-1, -1},
                   {0, -1}, {1, -1}, {1, 0},  {1, 1}};
const int maxn = 1e6 + 10;
int stk[maxn];
int A[maxn];
int main() {
  int n;
  int ans = 0;
  cin >> n;
  memset(stk, 0, sizeof(stk));
  for (int i = 0; i < n; i++) cin >> A[i];
  int top = 0;
  for (int i = 0; i < n; i++) {
    while (top && A[stk[top]] < A[i]) ans = max(ans, A[i] ^ A[stk[top]]), --top;
    stk[++top] = i;
  }
  top = 0;
  for (int i = n - 1; i >= 0; i--) {
    while (top && A[stk[top]] < A[i]) ans = max(ans, A[i] ^ A[stk[top]]), --top;
    stk[++top] = i;
  }
  cout << ans << endl;
  return 0;
}
