#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > arr(n), cpy;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i].first;
    arr[i].second = i;
  }
  cpy = arr;
  sort(cpy.rbegin(), cpy.rend());
  int ans = 0;
  set<int> near;
  for (int i = 0; i < n; ++i) {
    auto it = near.upper_bound(cpy[i].second);
    if (it != near.end()) ans = max(ans, arr[*it].first ^ cpy[i].first);
    if (it != near.begin()) ans = max(ans, arr[*--it].first ^ cpy[i].first);
    near.insert(cpy[i].second);
  }
  cout << ans << '\n';
}
