#include <bits/stdc++.h>
using namespace std;
int fun(vector<int> v) {
  vector<int> s;
  int i, res = v[0] ^ v[1];
  for (i = 0; i < v.size(); i++) {
    while (!s.empty() && v[i] > s.back()) s.pop_back();
    s.push_back(v[i]);
    if (s.size() >= 2) res = max(res, s[s.size() - 1] ^ s[s.size() - 2]);
  }
  return res;
}
int main() {
  int n, i, x, res, res2;
  vector<int> v;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    v.push_back(x);
  }
  res = fun(v);
  reverse(v.begin(), v.end());
  res2 = fun(v);
  cout << max(res, res2) << "\n";
  return 0;
}
