#include <bits/stdc++.h>
using namespace std;
vector<int> a;
int solve() {
  int ans = 0;
  stack<int> s;
  for (int i = 0; i < a.size(); i++) {
    if (s.empty()) {
      s.push(a[i]);
    } else {
      while (!s.empty() && a[i] > s.top()) {
        ans = max(ans, a[i] ^ s.top());
        s.pop();
      }
      s.push(a[i]);
    }
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, ans = 0, x;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    a.push_back(x);
  }
  ans = solve();
  reverse(a.begin(), a.end());
  ans = max(ans, solve());
  cout << ans;
  return 0;
}
