#include <bits/stdc++.h>
const int maxn = 1e5 + 10;
long long stk[maxn], ans, top, N, arr[maxn];
inline long long read() {
  long long f = 1, r = 0;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') {
      f = -1;
    }
    c = getchar();
  }
  while (isdigit(c)) {
    r = 10 * r + c - '0';
    c = getchar();
  }
  return f * r;
}
int main() {
  N = read();
  for (register int i = 1; i <= N; ++i) {
    arr[i] = read();
  }
  for (register int i = 1; i <= N; ++i) {
    while (top && arr[stk[top]] <= arr[i]) top--;
    if (top) {
      ans = (((ans) > (arr[i] ^ arr[stk[top]])) ? (ans)
                                                : (arr[i] ^ arr[stk[top]]));
    }
    stk[++top] = i;
  }
  top = 0;
  std::reverse(arr + 1, arr + 1 + N);
  for (register int i = 1; i <= N; ++i) {
    while (top && arr[stk[top]] <= arr[i]) top--;
    if (top) {
      ans = (((ans) > (arr[i] ^ arr[stk[top]])) ? (ans)
                                                : (arr[i] ^ arr[stk[top]]));
    }
    stk[++top] = i;
  }
  std::cout << ans << "\n";
  return 0;
}
