#include <bits/stdc++.h>
using namespace std;
const int dir[4][2] = {1, 0, 0, 1, -1, 0, 0, -1};
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
const double pi = acos(-1);
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
int a[N];
int n, m, K;
stack<int> s;
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  vector<int> res;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    while (!s.empty() && a[i] > s.top()) s.pop();
    if (!s.empty()) res.push_back(a[i] ^ s.top());
    s.push(a[i]);
  }
  while (!s.empty()) s.pop();
  for (int i = n; i; --i) {
    while (!s.empty() && a[i] > s.top()) s.pop();
    if (!s.empty()) res.push_back(a[i] ^ s.top());
    s.push(a[i]);
  }
  sort(res.begin(), res.end());
  cout << res[res.size() - 1] << endl;
  return 0;
}
