#include <bits/stdc++.h>   using namespace std;   using ll = long long;   ll dx[] = {0, 0, 1, -1};   ll dy[] = {1, -1, 0, 0};   void solve() {     ll n;     cin >> n;     vector<ll> v(n);     for (ll i = 0; i < (n); ++i) cin >> v[i];     vector<pair<ll, ll>> aux(n);     ll i = n - 1;     stack<ll> s;     while (i >= 0) {       while (!s.empty() && s.top() < v[i]) s.pop();       if (s.empty())         aux[i].first = -1;       else         aux[i].first = s.top();       s.push(v[i]);       i--;     }     i = 0;     while (!s.empty()) s.pop();     while (i < n) {       while (!s.empty() && s.top() < v[i]) s.pop();       if (s.empty())         aux[i].second = -1;       else         aux[i].second = s.top();       s.push(v[i]), i++;     }     ll res = 0;     for (ll i = 0; i < (n); ++i) {       if (aux[i].first != -1) res = max(res, aux[i].first ^ v[i]);       if (aux[i].second != -1) res = max(res, aux[i].second ^ v[i]);     }     cout << res <<   n ;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     ll t = 1;     while (t--) solve();     return 0;   }   