#include <bits/stdc++.h>
int n;
std::stack<int> stack;
int main() {
  scanf("%d", &n);
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    int si;
    scanf("%d", &si);
    while (!stack.empty() && stack.top() < si) {
      ans = std::max(ans, stack.top() ^ si);
      stack.pop();
    }
    if (!stack.empty()) ans = std::max(ans, stack.top() ^ si);
    stack.push(si);
  }
  printf("%d\n", ans);
  return 0;
}
