#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 5;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long n, a[maxn];
stack<long long> s;
long long ans;
inline long long solve() {
  long long ret = 0;
  for (long long i = 1; i <= n; i++) {
    while (s.size() && s.top() < a[i]) s.pop();
    if (s.size()) ret = max(ret, s.top() ^ a[i]);
    s.push(a[i]);
  }
  return ret;
}
signed main() {
  n = read();
  for (long long i = 1; i <= n; i++) a[i] = read();
  ans = solve();
  reverse(a + 1, a + n + 1);
  ans = max(ans, solve());
  cout << ans;
  return 0;
}
