#include <bits/stdc++.h>
using namespace std;
int inp[161616], n, rslt = 0;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> inp[i];
  deque<int> q;
  for (int i = 0; i < n; i++) {
    int p = inp[i];
    while (!q.empty() && q.front() < p) q.pop_front();
    if (!q.empty()) rslt = max(rslt, p ^ q.front());
    q.push_front(p);
  }
  q.clear();
  for (int i = n - 1; 0 <= i; i--) {
    int p = inp[i];
    while (!q.empty() && q.front() < p) q.pop_front();
    if (!q.empty()) rslt = max(rslt, p ^ q.front());
    q.push_front(p);
  }
  cout << rslt << endl;
  return 0;
}
