#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> v;
int main() {
  int ans = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    while (v.size() and v.back() < x) {
      ans = max(ans, v.back() ^ x);
      v.pop_back();
    }
    if (v.size()) {
      ans = max(ans, v.back() ^ x);
    }
    v.push_back(x);
  }
  printf("%d\n", ans);
  return 0;
}
