#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> a;
int best() {
  vector<int> s;
  int ans = 0;
  for (int x : a) {
    while (!s.empty() and s.back() < x) s.pop_back();
    s.push_back(x);
    int ns = s.size();
    if (ns >= 2) ans = max(ans, s[ns - 2] ^ s[ns - 1]);
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
  cin >> n;
  a.assign(n, 0);
  for (int i = 0; i < n; ++i) cin >> a[i];
  int ans = best();
  reverse(begin(a), end(a));
  cout << max(ans, best()) << "\n";
  return 0;
}
