#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > m;
void NGE(long long a[], long long n) {
  stack<int> s;
  s.push(a[0]);
  for (long long i = 1; i < n; i++) {
    int next = a[i];
    if (s.empty() == false) {
      long long element = s.top();
      s.pop();
      while (element < next) {
        m.push_back({element, next});
        if (s.empty() == true) break;
        element = s.top();
        s.pop();
      }
      if (element > next) s.push(element);
    }
    s.push(next);
  }
  while (s.empty() == false) {
    m.push_back({s.top(), -1});
    s.pop();
  }
}
int main() {
  long long a[100002], n;
  cin >> n;
  long long xo, maxi = 0;
  for (long long i = 0; i < n; i++) cin >> a[i];
  NGE(a, n);
  reverse(a, a + n);
  NGE(a, n);
  for (long long i = 0; i < m.size(); i++)
    if (m[i].second != '1') {
      xo = m[i].first ^ m[i].second;
      if (xo > maxi) maxi = xo;
    }
  cout << maxi;
}
