#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2;
const int INF = 1e9 + 7;
int num[N];
int q[N];
int solve(int n) {
  int it = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    for (; it && q[it - 1] < num[i]; it--)
      ;
    if (it) ans = max(ans, q[it - 1] ^ num[i]);
    q[it++] = num[i];
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &num[i]);
  }
  int ans = solve(n);
  reverse(num, num + n);
  ans = max(ans, solve(n));
  cout << ans;
  return 0;
}
