#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int arr[n], answer = 0;
  for (int i = (0); i < (n); ++i) scanf("%d", &arr[i]);
  stack<int> S;
  int right[n], left[n];
  for (int i = (0); i < (n); ++i) {
    while (!S.empty() && arr[i] >= arr[S.top()]) S.pop();
    if (S.empty())
      left[i] = -1;
    else
      left[i] = S.top();
    S.push(i);
  }
  while (!S.empty()) S.pop();
  for (int i = (n - 1); i >= (0); --i) {
    while (!S.empty() && arr[i] >= arr[S.top()]) S.pop();
    if (S.empty())
      right[i] = n;
    else
      right[i] = S.top();
    S.push(i);
  }
  int ans = 0;
  for (int i = (0); i < (n); ++i) {
    if (left[i] != -1) ans = max(ans, arr[i] ^ arr[left[i]]);
    if (right[i] != n) ans = max(ans, arr[i] ^ arr[right[i]]);
  }
  printf("%d\n", ans);
  return 0;
}
