#include <bits/stdc++.h>
using namespace std;
const int N = 1000 * 100 + 10;
int n, ans, a[N];
vector<int> vec;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  ans = a[0] ^ a[1];
  for (int i = 0; i < n; i++) {
    while (!vec.empty() && vec.back() < a[i]) vec.pop_back();
    vec.push_back(a[i]);
    if (vec.size() >= 2)
      ans = max(ans, vec[vec.size() - 1] ^ vec[vec.size() - 2]);
  }
  reverse(a, a + n);
  vec.clear();
  for (int i = 0; i < n; i++) {
    while (!vec.empty() && vec.back() < a[i]) vec.pop_back();
    vec.push_back(a[i]);
    if (vec.size() >= 2)
      ans = max(ans, vec[vec.size() - 1] ^ vec[vec.size() - 2]);
  }
  cout << ans << endl;
  return 0;
}
