#include <bits/stdc++.h>
int dx[] = {+0, +0, -1, +1, +1, +1, -1, -1};
int dy[] = {+1, -1, +0, +0, +1, -1, +1, -1};
using namespace std;
int n, k, a[100000 + 5], res, A, B;
int main() {
  scanf("%d", &n);
  for (int i = int(1); i <= int(n); i++) scanf("%d", &a[i]);
  k = 0;
  for (int i = int(31 - 1); i >= 0; i--) {
    for (int j = int(2); j <= int(n); j++)
      if ((a[j] & (1 << i)) != (a[j - 1] & (1 << i))) {
        k = i;
        break;
      }
    if (k != 0) break;
  }
  res = A = B = 0;
  for (int i = int(1); i <= int(n); i++) {
    if (a[i] & (1 << k)) {
      A = a[i];
      B = 0;
      continue;
    }
    B = max(a[i], B);
    if (A > 0) res = max(res, A ^ B);
  }
  A = B = 0;
  for (int i = int(n); i >= int(1); i--) {
    if (a[i] & (1 << k)) {
      A = a[i];
      B = 0;
      continue;
    }
    B = max(a[i], B);
    if (A > 0) res = max(res, A ^ B);
  }
  cout << res << endl;
  return 0;
}
