#include <bits/stdc++.h>
using namespace std;
int a[100002];
int main() {
  int n, size = 0, maxi = -1, big;
  cin >> n;
  cin >> a[0];
  big = a[0];
  for (int i = 1; i < n; i++) {
    int x;
    cin >> x;
    while (size >= 0) {
      if (a[size] < x) {
        maxi = max(maxi, (x ^ a[size]));
        size--;
      } else
        break;
    }
    if (size >= 0) maxi = max((x ^ a[size]), maxi);
    size++;
    a[size] = x;
  }
  cout << maxi << endl;
}
