#include<bits/stdc++.h>
using namespace std;
#define MAX 900
#define MAX1 13770000
#define inf 1000000000
#define mod 1000000007
#define ll long long
int arr[MAX+5];
struct node
{
int ptr[2];
}buffer[MAX1+5];
int nn,root[MAX+5];
int Insert(int a,int prev)
{
int i,ret=++nn,t;
bool bit;
t=ret;
for(i=17;i>=0;--i)
{
bit=a&(1<<i);
buffer[t]=buffer[prev];
buffer[t].ptr[bit]=++nn;
t=buffer[t].ptr[bit];
prev=buffer[prev].ptr[bit];
}
return ret;
}
int Search(int a,int t)
{
int i,dir,ans=0;
bool bit;
for(i=17;i>=0;--i)
{
bit=a&(1<<i);
dir=buffer[t].ptr[bit^1];
if(dir)
{
t=dir;
ans|=(1<<i);
}
else
t=buffer[t].ptr[bit];
}
return ans;
}
int main()
{
ios::sync_with_stdio(false);
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int n,i,j,sum,cool,prev;
cin>>n;
for(i=1;i<=n;++i)
cin>>arr[i];
for(i=1;i<=n;++i)
{
sum=0;
prev=root[i-1];
for(j=i;j>=1;--j)
{
sum+=arr[j];
root[i]=Insert(sum,prev);
prev=root[i];
}
}
cool=0;
for(i=1;i<=n;++i)
{
sum=0;
for(j=i;j<=n;++j)
{
sum+=arr[j];
cool=max(cool,Search(sum,root[i-1]));
}
}
cout<<cool;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKIAojZGVmaW5lIE1BWCA5MDAKI2RlZmluZSBNQVgxIDEzNzcwMDAwCiNkZWZpbmUgaW5mIDEwMDAwMDAwMDAKI2RlZmluZSBtb2QgMTAwMDAwMDAwNwojZGVmaW5lIGxsIGxvbmcgbG9uZwogCmludCBhcnJbTUFYKzVdOwpzdHJ1Y3Qgbm9kZQp7CiAgICBpbnQgcHRyWzJdOwp9YnVmZmVyW01BWDErNV07CmludCBubixyb290W01BWCs1XTsKIAppbnQgSW5zZXJ0KGludCBhLGludCBwcmV2KQp7CiAgICBpbnQgaSxyZXQ9Kytubix0OwogICAgYm9vbCBiaXQ7CiAgICB0PXJldDsKICAgIGZvcihpPTE3O2k+PTA7LS1pKQogICAgewogICAgICAgIGJpdD1hJigxPDxpKTsKICAgICAgICBidWZmZXJbdF09YnVmZmVyW3ByZXZdOwogICAgICAgIGJ1ZmZlclt0XS5wdHJbYml0XT0rK25uOwogICAgICAgIHQ9YnVmZmVyW3RdLnB0cltiaXRdOwogICAgICAgIHByZXY9YnVmZmVyW3ByZXZdLnB0cltiaXRdOwogICAgfQogICAgcmV0dXJuIHJldDsKfQppbnQgU2VhcmNoKGludCBhLGludCB0KQp7CiAgICBpbnQgaSxkaXIsYW5zPTA7CiAgICBib29sIGJpdDsKICAgIGZvcihpPTE3O2k+PTA7LS1pKQogICAgewogICAgICAgIGJpdD1hJigxPDxpKTsKICAgICAgICBkaXI9YnVmZmVyW3RdLnB0cltiaXReMV07CiAgICAgICAgaWYoZGlyKQogICAgICAgIHsKICAgICAgICAgICAgdD1kaXI7CiAgICAgICAgICAgIGFuc3w9KDE8PGkpOwogICAgICAgIH0KICAgICAgICBlbHNlCiAgICAgICAgICAgIHQ9YnVmZmVyW3RdLnB0cltiaXRdOwogICAgfQogICAgcmV0dXJuIGFuczsKfQppbnQgbWFpbigpCnsKICAgIGlvczo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsKICAgIC8vZnJlb3BlbigiaW4udHh0IiwiciIsc3RkaW4pOwogICAgLy9mcmVvcGVuKCJvdXQudHh0IiwidyIsc3Rkb3V0KTsKICAgIGludCBuLGksaixzdW0sY29vbCxwcmV2OwogICAgY2luPj5uOwogICAgZm9yKGk9MTtpPD1uOysraSkKICAgICAgICBjaW4+PmFycltpXTsKICAgIGZvcihpPTE7aTw9bjsrK2kpCiAgICB7CiAgICAgICAgc3VtPTA7CiAgICAgICAgcHJldj1yb290W2ktMV07CiAgICAgICAgZm9yKGo9aTtqPj0xOy0taikKICAgICAgICB7CiAgICAgICAgICAgIHN1bSs9YXJyW2pdOwogICAgICAgICAgICByb290W2ldPUluc2VydChzdW0scHJldik7CiAgICAgICAgICAgIHByZXY9cm9vdFtpXTsKICAgICAgICB9CiAgICB9CiAgICBjb29sPTA7CiAgICBmb3IoaT0xO2k8PW47KytpKQogICAgewogICAgICAgIHN1bT0wOwogICAgICAgIGZvcihqPWk7ajw9bjsrK2opCiAgICAgICAgewogICAgICAgICAgICBzdW0rPWFycltqXTsKICAgICAgICAgICAgY29vbD1tYXgoY29vbCxTZWFyY2goc3VtLHJvb3RbaS0xXSkpOwogICAgICAgIH0KICAgIH0KICAgIGNvdXQ8PGNvb2w7CiAgICByZXR1cm4gMDsKfQ==