#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
  return f ? -x : x;
}
void write(int x) {
  if (x < 0) x = -x, putchar('-');
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
void writeln(int x) {
  write(x);
  puts("");
}
int a[100020], q[100020], n, top, ans;
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  for (int i = 1; i <= n; ++i) {
    while (a[q[top]] < a[i] && top) ans = max(ans, a[q[top--]] ^ a[i]);
    q[++top] = i;
  }
  top = 0;
  for (int i = n; i >= 1; --i) {
    while (a[q[top]] < a[i] && top) ans = max(ans, a[q[top--]] ^ a[i]);
    q[++top] = i;
  }
  writeln(ans);
}
