#include<bits/stdc++.h>
using namespace std;
int n,a[1001],v[32];
long long ans=0;
inline const void read(int &a)
{
a=0;
char c=getchar();
while(c<'0'||c>'9') c=getchar();
while(c>='0'&&c<='9')
{
a=(a<<1)+(a<<3)+c-'0';
c=getchar();
}
}
bool com(int a,int b)
{
return a>b;
}
int main()
{
int i,k,s;
memset(v,0,sizeof(v));
read(n);
for(i=1;i<=n;i++) read(a[i]);
sort(a+1,a+1+n,com);
for(i=1;i<=n;i++)
{
for(k=30;k>=0;k--)
{
//cout<<"a["<<i<<"]="<<a[i]<<" 1<<"<<k<<"="<<(1<<k)<<endl;
if((1<<k)<a[i]&&(a[i]&(1<<k)))
{
//cout<<"i="<<i<<" k="<<k<<endl;
s=k;
if(!v[k])
{
//cout<<"i="<<i<<" k="<<k<<endl;
v[k]=1;
break;
}
}
}
//cout<<"i="<<i<<" a["<<i<<"]="<<a[i]<<" k="<<k<<endl;
if(k==-1)
v[s]=abs(v[s]-1);
}
//for(int i=1;i<=30;i++)
//if(v[i])
//cout<<i<<' ';
//cout<<endl;
for(i=0;i<=30;i++)
if(v[i])
{
//cout<<"v["<<i<<"]="<<(1<<i)<<endl;
ans+=(1<<i);
}
cout<<ans<<endl;
return 0;
}