#include <bits/stdc++.h>
using namespace std;
int n;
int s[100010];
int a[100010][32];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%d", s + i);
  for (int i = 0; i <= 30; i++) {
    for (int j = 0; j < n; j++) {
      if ((s[j] & (1 << i)) == (1 << i)) {
        a[j][i] = 1;
      } else
        a[j][i] = 0;
    }
  }
  int p = -1;
  for (int i = 30; i >= 0; i--) {
    bool good = false;
    int t = 0;
    for (int j = 0; j < n; j++) t += a[j][i];
    for (int j = 0; j < n; j++) {
      if (a[j][i] == 0 && t > 0) {
        good = true;
        p = i;
        break;
      }
    }
    if (good) break;
  }
  long long res = 0;
  int last = 0;
  for (int i = 0; i < n; i++) {
    if (a[i][p] == 1) {
      int m = 0;
      for (int j = i - 1; j >= last; j--) {
        if (s[j] > m) {
          res = max((long long)s[j] ^ (long long)s[i], res);
          m = s[j];
        }
      }
      m = 0;
      for (int j = i + 1; j < n; j++) {
        if (a[j][p] == 1) {
          last = i + 1;
          break;
        }
        if (s[j] > m) {
          res = max((long long)s[j] ^ (long long)s[i], res);
          m = s[j];
        }
      }
    }
  }
  cout << res << endl;
  return 0;
}
