#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  stack<int> s;
  for (int i = 0; i < n; i++) {
    while (s.size() && s.top() < a[i]) {
      ans = max(ans, a[i] ^ s.top());
      s.pop();
    }
    if (s.size()) ans = max(ans, a[i] ^ s.top());
    s.push(a[i]);
  }
  stack<int> t;
  for (int i = n - 1; i > -1; i--) {
    while (t.size() && t.top() < a[i]) {
      ans = max(ans, a[i] ^ t.top());
      t.pop();
    }
    if (t.size()) ans = max(ans, a[i] ^ t.top());
    t.push(a[i]);
  }
  cout << ans;
  return 0;
}
