#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
long long powm(long long a, long long b, long long mod) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
const long long mod = 1e9 + 7;
const long long N = 1000005;
const long long inf = 1e9;
void solve() {
  int n;
  cin >> n;
  deque<long long> dq;
  long long ans = 0;
  while (n--) {
    long long x;
    cin >> x;
    if (dq.size() == 0) {
      dq.push_back(x);
      continue;
    }
    if (dq.size() > 0) ans = max(ans, (dq.back() ^ x));
    while (dq.size() > 0 and dq.back() < x) {
      ans = max(ans, (x ^ dq.back()));
      dq.pop_back();
    }
    if (dq.size() > 0) ans = max(ans, (dq.back() ^ x));
    dq.push_back(x);
  }
  long long curr = dq.back();
  dq.pop_back();
  while (!dq.empty()) {
    ans = max(ans, (curr ^ dq.back()));
    curr = dq.back();
    dq.pop_back();
  }
  cout << ans << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);
  int tc = 1;
  while (tc--) {
    solve();
  }
  return 0;
}
