#include <bits/stdc++.h>
using namespace std;
inline int max(int a, int b) { return a > b ? a : b; }
inline int min(int a, int b) { return a < b ? a : b; }
inline int gcd(int a, int b) {
  if (a % b)
    return gcd(b, a % b);
  else
    return b;
}
inline int lcm(int a, int b) { return (a * (b / gcd(a, b))); }
inline int And(int mask, int bit) { return mask & (1 << bit); }
inline int Or(int mask, int bit) { return mask | (1 << bit); }
inline int Xor(int mask, int bit) { return mask & (~(1 << bit)); }
int n, ans, x, y;
int a[100111], l[100111], r[100111];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  l[1] = 0;
  r[n] = n + 1;
  for (int i = 2; i <= n; i++) {
    l[i] = i - 1;
    while (a[l[i]] < a[i]) {
      l[i] = l[l[i]];
      if (l[i] == 0) break;
    }
  }
  for (int i = n - 1; i >= 1; i--) {
    r[i] = i + 1;
    while (a[r[i]] < a[i]) {
      r[i] = r[r[i]];
      if (r[i] == n + 1) break;
    }
  }
  ans = 0;
  for (int i = 1; i <= n; i++) {
    x = l[i];
    y = r[i];
    if (x != i && x != 0) ans = max(ans, a[i] ^ a[x]);
    if (y != i && y != n + 1) ans = max(ans, a[i] ^ a[y]);
  }
  printf("%d\n", ans);
  return 0;
}
