#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int A[n];
  for (int i = 0; i < n; i++) cin >> A[i];
  stack<int> s;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    while (s.size() > 0 && A[i] > s.top()) s.pop();
    if (s.size()) ans = max(ans, A[i] ^ s.top());
    s.push(A[i]);
  }
  while (s.size()) s.pop();
  reverse(A, A + n);
  for (int i = 0; i < n; i++) {
    while (s.size() > 0 && A[i] > s.top()) s.pop();
    if (s.size()) ans = max(ans, A[i] ^ s.top());
    s.push(A[i]);
  }
  cout << ans;
}
