#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  return (b != 0 ? gcd<T>(b, a % b) : a);
}
template <class T>
T lcm(T a, T b) {
  return (a / gcd<T>(a, b) * b);
}
long long pwr(long long base, long long p) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans = (ans * base) % (1000000007LL);
    base = (base * base) % (1000000007LL);
    p >>= 1;
  }
  return ans;
}
long long modInv(long long n, long long mod) { return pwr(n, mod - 2); }
int bitCount(int n) {
  int c = 0;
  while (n) {
    c++;
    n &= n - 1;
  }
  return c;
}
int arr[200000];
stack<long long> st;
int main() {
  std::ios::sync_with_stdio(false);
  int n, i, temp;
  cin >> n;
  int p = 0, ans = 0;
  for (i = 0; i < n; i++) {
    cin >> temp;
    while (p > 0) {
      ans = max(ans, temp ^ arr[p]);
      ;
      if (temp > arr[p])
        p--;
      else
        break;
    }
    arr[++p] = temp;
  }
  cout << ans;
  return 0;
}
