#include <bits/stdc++.h>
using namespace std;
bool prime[1000000];
void seive_of_prime() {
  memset(prime, 1, sizeof(prime));
  prime[0] = 0;
  prime[1] = 0;
  int i = 2;
  while (i <= 1000000) {
    if (prime[i] != 0) {
      for (int j = i + i; j <= 1000000; j += i) {
        prime[j] = 0;
      }
    }
    i++;
  }
}
void prime_factor(long long n) {
  int x = 2;
  while (n != 1) {
    if (n % x == 0) {
      cout << x << ' ';
      n /= x;
    } else {
      x++;
    }
  }
}
bool divisor(long long int n) {
  int c1 = 0;
  for (int i = 1; i <= sqrt(n) + 1; i++) {
    if (n % i == 0) {
      if (i == n / i) {
        c1++;
      } else {
        c1 += 2;
      }
    }
  }
  if (c1 == 2) {
    return true;
  } else {
    return false;
  }
}
long long gcd(long long a, long long b) {
  if (a == 0) {
    return b;
  }
  if (b == 0) {
    return a;
  }
  if (a == b) {
    return a;
  }
  if (a > b) {
    return gcd((a - (a / b) * b), b);
  } else {
    return gcd((b - (b / a) * a), a);
  }
}
long long power(long long base, long long exp) {
  long long res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) {
      res = (res * base) % 1000000007;
    }
    base = (base * base) % 1000000007;
    exp /= 2;
  }
  return res % 1000000007;
}
long long powe(long long x, long long y) {
  if (y == 0) {
    return 1;
  }
  if (y == 1) {
    return x;
  } else if (y % 2 == 0) {
    long long x1 = powe(x, (long long)y / 2);
    long long t1 = (long long)(x1 * x1);
    if (t1 >= 1000000007) {
      return t1 % 1000000007;
    } else {
      return t1;
    }
  } else {
    long long x1 = powe(x, (long long)((y - 1) / 2));
    long long t1 = (long long)(((long long)(x1 * x1)) % 1000000007) * x;
    if (t1 >= 1000000007) {
      return t1 % 1000000007;
    } else {
      return t1;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  ;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  stack<long long> st;
  st.push(a[0]);
  long long max = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] < st.top()) {
      long long temp = a[i] ^ st.top();
      if (temp > max) {
        max = temp;
      }
      st.push(a[i]);
    } else {
      while ((!st.empty()) && a[i] > st.top()) {
        long long temp = a[i] ^ st.top();
        if (temp > max) {
          max = temp;
        }
        st.pop();
      }
      if (!st.empty()) {
        long long temp = a[i] ^ st.top();
        if (temp > max) {
          max = temp;
        }
      }
      st.push(a[i]);
    }
  }
  cout << max;
  return 0;
}
