#include <bits/stdc++.h>
int main() {
  int n, a[100010];
  std::cin >> n;
  for (int i = 0; i < n; ++i) std::cin >> a[i];
  std::vector<int> s;
  int ans = 0;
  s.push_back(a[0]);
  for (int i = 1; i < n; ++i) {
    while (!s.empty() && a[i] > s.back()) {
      ans = std::max(ans, a[i] ^ s.back());
      s.pop_back();
    }
    if (!s.empty()) ans = std::max(ans, a[i] ^ s.back());
    s.push_back(a[i]);
  }
  std::cout << ans;
}
