#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 4;
long long l[N], r[N], a[N];
int main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  stack<long long> s;
  for (long long i = 1; i <= n; i++) {
    while (s.size() && a[s.top()] <= a[i]) s.pop();
    if (s.size() == 0)
      l[i] = i;
    else
      l[i] = s.top();
    s.push(i);
  }
  while (!s.empty()) s.pop();
  for (long long i = n; i >= 1; i--) {
    while (s.size() && a[s.top()] <= a[i]) s.pop();
    if (s.size() == 0)
      r[i] = i;
    else
      r[i] = s.top();
    s.push(i);
  }
  long long ans = -1;
  for (long long i = 1; i <= n; i++) {
    ans = max(ans, max(a[l[i]] ^ a[i], a[i] ^ a[r[i]]));
  }
  printf("%lld\n", ans);
}
