#include <bits/stdc++.h>
using namespace std;
long long n, maks = 0, in;
stack<long long> s;
int main() {
  cin >> n;
  cin >> in;
  s.push(in);
  for (int i = 1; i < n; i++) {
    cin >> in;
    while (in > s.top() && s.size() > 1) {
      maks = max(maks, s.top() ^ in);
      s.pop();
    }
    maks = max(maks, s.top() ^ in);
    if (in > s.top()) s.pop();
    s.push(in);
  }
  cout << maks << endl;
}
