#include <bits/stdc++.h>
using namespace std;
long long arr[100005], nxt[100005];
long long n;
void nxt_greater() {
  stack<long long> s;
  s.push(0);
  for (long long i = 1; i < n; i++) {
    while (!s.empty() && arr[s.top()] < arr[i]) {
      nxt[s.top()] = i;
      s.pop();
    }
    s.push(i);
  }
  while (!s.empty()) {
    nxt[s.top()] = -1;
    s.pop();
  }
}
int main() {
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> arr[i];
  nxt_greater();
  long long max_xor = 0;
  for (long long i = 0; i < n; i++) {
    if (nxt[i] >= 0) {
      max_xor = max(max_xor, arr[i] ^ arr[nxt[i]]);
    }
  }
  reverse(arr, arr + n);
  nxt_greater();
  for (long long i = 0; i < n; i++) {
    if (nxt[i] >= 0) {
      max_xor = max(max_xor, arr[i] ^ arr[nxt[i]]);
    }
  }
  cout << max_xor << endl;
}
