#include <bits/stdc++.h>
using namespace std;
int main() {
  int len;
  cin >> len;
  int inp[len], stack[len], nxt[len], prev[len], head = -1;
  for (int i = 0; i < len; ++i) {
    cin >> inp[i];
    if (head != -1 && inp[stack[head]] < inp[i]) {
      while (head >= 0 && inp[stack[head]] < inp[i]) nxt[stack[head--]] = i;
    }
    stack[++head] = i;
  }
  while (head > -1) nxt[stack[head--]] = -1;
  for (int i = len - 1; i > -1; --i) {
    if (head != -1 && inp[stack[head]] < inp[i]) {
      while (head >= 0 && inp[stack[head]] < inp[i]) prev[stack[head--]] = i;
    }
    stack[++head] = i;
  }
  while (head > -1) prev[stack[head--]] = -1;
  int max = 0;
  for (int i = 0; i < len; ++i) {
    int temp;
    if (nxt[i] != -1) {
      temp = inp[i] ^ inp[nxt[i]];
      max = ((temp > max) ? temp : max);
    }
    if (prev[i] != -1) {
      temp = inp[i] ^ inp[prev[i]];
      max = ((temp > max) ? temp : max);
    }
  }
  cout << max << '\n';
}
