#include <bits/stdc++.h>
using namespace std;
struct Node {
  int num, no;
} s[101010];
map<int, int> mp1, mp2;
bool cmp(Node a, Node b) { return a.num > b.num; }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &s[i].num);
    s[i].no = i;
  }
  int ans = 0;
  mp1.clear();
  mp2.clear();
  mp1[0] = mp2[n + 1] = s[1].num;
  mp1[n + 1] = mp2[0] = s[n].num;
  sort(s + 1, s + 1 + n, cmp);
  for (int i = 1; i <= n; i++) {
    mp1[s[i].no] = s[i].num;
    mp2[n - s[i].no + 1] = s[i].num;
    map<int, int>::iterator it = mp1.upper_bound(s[i].no);
    if (it->first != n + 1) ans = max(ans, it->second ^ s[i].num);
    it = mp2.upper_bound(n - s[i].no + 1);
    if (it->first != n + 1) ans = max(ans, it->second ^ s[i].num);
  }
  printf("%d\n", ans);
  return 0;
}
