#include <bits/stdc++.h>
using namespace std;
long long data[111111];
int main() {
  int n;
  while (cin >> n) {
    long long e = 0, ans = 0;
    for (int i = 0; i != n; i++) {
      int tmp;
      cin >> tmp;
      while (e > 0) {
        if ((tmp ^ data[e]) > ans) ans = (tmp ^ data[e]);
        if (tmp > data[e])
          e--;
        else
          break;
      }
      data[++e] = tmp;
    }
    cout << ans << endl;
  }
  return 0;
}
