#include <bits/stdc++.h>
using namespace std;
int n;
int arr[100002];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  stack<int> stk;
  stk.push(arr[0]);
  long long res = 0;
  for (int i = 1; i < n; i++) {
    while (!stk.empty()) {
      if (arr[i] < stk.top()) break;
      res = max(res, 1LL * stk.top() ^ arr[i]);
      stk.pop();
    }
    res = max(res, 1LL * (!stk.empty() ? arr[i] ^ stk.top() : 0));
    stk.push(arr[i]);
  }
  cout << res;
  return 0;
}
