#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn=100010;
int n,a[maxn],r,q[maxn];
inline int read(){
int num=0;
char ch=getchar();
while(ch<'0'||ch>'9') ch=getchar();
while(ch>='0'&&ch<='9') num=num*10+ch-'0',ch=getchar();
return num;
}
int main(){
int ans;
n=read();
for(int i=1;i<=n;i++) a[i]=read();
ans=a[1] xor a[2];
if(a[1]>a[2]){
q[++r]=a[1];
q[++r]=a[2];
}
else a[++r]=a[2];
for(int i=3;i<=n;i++){
ans=max(ans,a[i] xor q[r]);
//cout<<i<<' '<<r<<endl;
while(r>0&&a[i]>=q[r]){
--r;
ans=max(ans,a[i] xor q[r]);
//cout<<i<<' '<<r<<endl;
}
q[++r]=a[i];
}
cout<<ans<<endl;
return 0;
}
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn=100010;
int n,a[maxn],r,q[maxn];
inline int read(){
int num=0;
char ch=getchar();
while(ch<'0'||ch>'9') ch=getchar();
while(ch>='0'&&ch<='9') num=num*10+ch-'0',ch=getchar();
return num;
}
int main(){
int ans;
n=read();
for(int i=1;i<=n;i++) a[i]=read();
ans=a[1] xor a[2];
if(a[1]>a[2]){
q[++r]=a[1];
q[++r]=a[2];
}
else a[++r]=a[2];
for(int i=3;i<=n;i++){
ans=max(ans,a[i] xor q[r]);
//cout<<i<<' '<<r<<endl;
while(r>0&&a[i]>=q[r]){
--r;
ans=max(ans,a[i] xor q[r]);
//cout<<i<<' '<<r<<endl;
}
q[++r]=a[i];
}
cout<<ans<<endl;
return 0;
}