#include <bits/stdc++.h>
using namespace std;
int N;
stack<int> S;
int main(void) {
  scanf("%d", &N);
  int sol = 0;
  for (int i = 0; i < N; ++i) {
    int curr, prev;
    scanf("%d", &curr);
    if (S.empty()) {
      S.push(curr);
      continue;
    } else {
      prev = S.top();
    }
    if (curr < prev) {
      sol = max(sol, curr ^ prev);
      S.push(curr);
      continue;
    }
    while (!S.empty() && curr > S.top()) {
      sol = max(sol, curr ^ S.top());
      S.pop();
    }
    if (!S.empty()) sol = max(sol, curr ^ S.top());
    S.push(curr);
  }
  printf("%d\n", sol);
  return 0;
}
