#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j, lucky, mxInTemp = 0, ct = 0;
  cin >> n;
  long long ar[n];
  for (i = 0; i < n; i++) {
    cin >> ar[i];
  }
  stack<long long> go;
  stack<long long> temp;
  go.push(ar[0]);
  go.push(ar[1]);
  lucky = ar[0] ^ ar[1];
  long long templucky = 0;
  for (i = 2; i < n; i++) {
    mxInTemp = 0;
    ct = 0;
    while (go.size()) {
      if (go.top() > ar[i]) {
        ct++;
        if (ct < 2) {
          templucky = go.top() ^ ar[i];
          temp.push(go.top());
          go.pop();
          mxInTemp = temp.top();
          if (templucky > lucky) {
            lucky = templucky;
          }
        } else {
          break;
        }
      } else {
        if (go.top() > mxInTemp) {
          mxInTemp = go.top();
          templucky = go.top() ^ ar[i];
          temp.push(go.top());
          go.pop();
          if (templucky > lucky) {
            lucky = templucky;
          }
        } else {
          go.pop();
        }
      }
    }
    while (temp.size()) {
      go.push(temp.top());
      temp.pop();
    }
    go.push(ar[i]);
  }
  cout << lucky;
}
