#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, ans = -1;
  cin >> n;
  stack<long long> stk;
  for (long long i = 0; i < n; i++) {
    long long in;
    cin >> in;
    while (!stk.empty()) {
      if (in < stk.top()) {
        ans = max(ans, stk.top() ^ in);
        stk.push(in);
        break;
      } else {
        ans = max(ans, stk.top() ^ in);
        stk.pop();
      }
    }
    stk.push(in);
  }
  cout << ans;
}
