#include <bits/stdc++.h>
using namespace std;
int arr[100001];
int main(int argc, char *argv[]) {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  stack<int> mystack;
  int maxVal = 0;
  for (int i = 0; i < n; i++) {
    if (!mystack.empty()) {
      while (!mystack.empty() && mystack.top() < arr[i]) {
        maxVal = max(maxVal, mystack.top() ^ arr[i]);
        mystack.pop();
      }
    }
    if (!mystack.empty()) maxVal = max(maxVal, arr[i] ^ mystack.top());
    mystack.push(arr[i]);
  }
  cout << maxVal << endl;
}
