#include <bits/stdc++.h>
using namespace std;
const int MAX = 100000 + 5;
const long long inf = 1e18;
int arr[MAX];
long long L[MAX], R[MAX];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  stack<long long> s;
  s.push(inf);
  for (int i = 1; i <= n; i++) {
    while (s.top() < arr[i]) s.pop();
    L[i] = s.top();
    s.push(arr[i]);
  }
  while (s.size() > 1) s.pop();
  for (int i = n; i >= 1; i--) {
    while (s.top() < arr[i]) s.pop();
    R[i] = s.top();
    s.push(arr[i]);
  }
  long long mx = 0;
  for (int i = 1; i <= n; i++) {
    if (L[i] < inf) mx = max(mx, arr[i] ^ L[i]);
    if (R[i] < inf) mx = max(mx, arr[i] ^ R[i]);
  }
  cout << mx << "\n";
  return 0;
}
