#include <bits/stdc++.h>
using namespace std;
long long a[500005], maxx[5000005], ans = 0, b[5000005], tot;
signed main() {
  long long n;
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", a + i);
  }
  for (long long i = 1; i <= n; i++) {
    while (a[i] > b[tot] && tot) ans = max(ans, a[i] ^ b[tot]), tot--;
    if (tot) ans = max(ans, b[tot] ^ a[i]);
    b[++tot] = a[i];
  }
  printf("%lld\n", ans);
  return 0;
}
