#include <bits/stdc++.h>
using namespace std;
constexpr int N = 1e5 + 5;
int n;
vector<long long> s;
vector<long long> c;
long long solve() {
  long long res = -1;
  for (int i = 1; i <= ((int)s.size()) - 1; ++i) {
    while ((!c.empty()) && (c.back() < s[i])) c.pop_back();
    c.push_back(s[i]);
    if (((int)c.size()) >= 2)
      res = max(res, c[((int)c.size()) - 1] ^ c[((int)c.size()) - 2]);
  }
  c.clear();
  for (int i = ((int)s.size()) - 1; i >= 1; --i) {
    while ((!c.empty()) && (c.back() < s[i])) c.pop_back();
    c.push_back(s[i]);
    if (((int)c.size()) >= 2)
      res = max(res, c[((int)c.size()) - 1] ^ c[((int)c.size()) - 2]);
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  s.resize(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> s[i];
  }
  cout << solve();
  return 0;
}
