#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
int n, a[N];
pair<int, int> p[N];
set<int> S;
set<int>::iterator it;
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); ++i) scanf("%d", &a[i]), p[i] = make_pair(a[i], i);
  sort(p, p + n);
  int ans = 0;
  for (int i = n - 1; i >= 0; --i) {
    it = S.upper_bound(p[i].second);
    if (it != S.end()) {
      ans = max(ans, a[*it] ^ p[i].first);
    }
    if (it != S.begin()) {
      --it;
      ans = max(ans, a[*it] ^ p[i].first);
    }
    S.insert(p[i].second);
  }
  printf("%d", ans);
  return 0;
}
