#include <bits/stdc++.h>
using namespace std;
const int inf = -0x3ffffff;
const long long maxn = 250000;
void read(int &x) {
  char ch;
  bool flag = 0;
  for (ch = getchar(); !isdigit(ch) && ((flag |= (ch == '-')) || 1);
       ch = getchar())
    ;
  for (x = 0; isdigit(ch); x = (x << 1) + (x << 3) + ch - 48, ch = getchar())
    ;
  x *= 1 - 2 * flag;
}
int val[maxn];
int ans = 0, Max[maxn], st = 0, ed = 0;
int n;
int solve() {
  int ret = 0;
  st = ed = 0;
  for (int i = 0; i < n; i++) {
    while (ed && Max[ed - 1] < val[i]) ed--;
    if (ed) ret = max(ret, Max[ed - 1] ^ val[i]);
    Max[ed++] = val[i];
  }
  return ret;
}
int main() {
  read(n);
  for (int i = 0; i < n; i++) read(val[i]);
  int ans = solve();
  reverse(val, val + n);
  ans = max(ans, solve());
  cout << ans << endl;
}
