#include <bits/stdc++.h>
using namespace std;
int N;
int in[100005];
int st[100005];
int cs;
int ans;
int main() {
  int i;
  scanf("%d", &N);
  for (i = 0; i < N; i++) scanf("%d", &in[i]);
  for (i = 0; i < N; i++) {
    while (cs > 0 && st[cs - 1] < in[i]) {
      ans = max(ans, (st[cs - 1] ^ in[i]));
      cs--;
    }
    if (cs > 0) ans = max(ans, (st[cs - 1] ^ in[i]));
    st[cs++] = in[i];
  }
  printf("%d\n", ans);
}
