#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a;
  stack<int> stk;
  int magic = 0;
  int ans;
  for (int i = 0; i < n; i++) {
    cin >> a;
    while (!stk.empty()) {
      if (stk.top() > a) break;
      ans = stk.top() ^ a;
      if (ans > magic) {
        magic = ans;
      }
      stk.pop();
    }
    if (!stk.empty()) {
      ans = stk.top() ^ a;
      if (ans > magic) {
        magic = ans;
      }
    }
    stk.push(a);
  }
  cout << magic << endl;
}
