#include <bits/stdc++.h>
using namespace std;
int N, ans, x;
stack<int> s;
inline int intread() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!('0' <= ch && ch <= '9')) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9')
    x = (x << 3) + (x << 1) + ch - 48, ch = getchar();
  return x * f;
}
int main() {
  N = intread();
  while (N--) {
    x = intread();
    while (!s.empty()) {
      ans = max(ans, x ^ s.top());
      if (x < s.top()) break;
      s.pop();
    }
    s.push(x);
  }
  printf("%d\n", ans);
  return 0;
}
