#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long dx[] = {-1, 0, 1, 0};
long long dy[] = {0, -1, 0, 1};
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long ans = 0;
  vector<long long> v;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    while (v.size() && v.back() < x) {
      ans = max(ans, x ^ v.back());
      v.pop_back();
    }
    if (v.size()) {
      ans = max(ans, x ^ v.back());
    }
    v.push_back(x);
  }
  cout << ans << "\n";
}
