#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int answer = 0;
  vector<int> stk;
  for (; n > 0; n--) {
    int x;
    cin >> x;
    while (not stk.empty() and stk.back() <= x) {
      answer = max(answer, stk.back() ^ x);
      stk.pop_back();
    }
    stk.push_back(x);
    if (stk.size() >= 2) {
      answer = max(answer, stk[stk.size() - 2] ^ stk[stk.size() - 1]);
    }
  }
  cout << answer << endl;
}
