#include <bits/stdc++.h>
using namespace std;
int a[100000 + 10];
int q[200000 + 10], head, tail;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int ans = a[0] ^ a[1];
  q[tail++] = a[0];
  q[tail++] = a[1];
  if (a[0] <= a[1]) {
    ++head;
  }
  for (int i = 2; i < n; ++i) {
    ans = max(ans, q[tail - 1] ^ a[i]);
    while (head < tail && q[tail - 1] < a[i]) {
      ans = max(ans, q[tail - 1] ^ a[i]);
      tail--;
    }
    if (head < tail) {
      ans = max(ans, q[tail - 1] ^ a[i]);
    }
    q[tail++] = a[i];
  }
  cout << ans << endl;
}
