#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int arr[N];
int nxt[N];
int ans;
int n;
void input() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
}
int calc() {
  stack<int> s;
  fill(nxt, nxt + N, -1);
  for (int i = 0; i < n; ++i) {
    while (!s.empty() && arr[i] >= arr[s.top()]) {
      nxt[s.top()] = i;
      s.pop();
    }
    s.push(i);
  }
  int res = 0;
  for (int i = 0; i < n; ++i) {
    if (nxt[i] != -1) {
      res = max(res, arr[i] ^ arr[nxt[i]]);
    }
  }
  return res;
}
void solve() {
  ans = max(ans, calc());
  reverse(arr, arr + n);
  ans = max(ans, calc());
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  input();
  solve();
}
