to sum up
See this problem, have been thinking mathematically, using the formula comes to shove, and then firmly dead inside the
Resolve
Thinking every bit to 1, A traversal odd numbers and every two of the bit is 1
B [J]% (J + 1 << 1), the modulo process useless data, seeking to facilitate binary range,
B [J] = [0, 2 I +. 1 -1]
B [J] + B [+ J. 1] = [0, 2 I + 2 -1]
For example: pos = 2, the bit. 1
NUM + B [J ] may be in the range of 1: 0100-0111 or 1100-1111
so: [2 I , 2 I + 1 -1] or [2 I +2 I + 1 , 2 I 2 + -2]
Therefore: [2 I , 2 I +. 1 -1 -b [J]] or [2 I +2 I +. 1 , 2 I + 2 -2-B [J]]
Topic Link
#include<bits/stdc++.h>
//typedef long long ll;
//#define ull unsigned long long
//#define int long long
#define F first
#define S second
#define endl "\n"//<<flush
#define eps 1e-6
#define lowbit(x) (x&(-x))
#define PI acos(-1.0)
#define inf 0x3f3f3f3f
#define MAXN 0x7fffffff
#define INF 0x3f3f3f3f3f3f3f3f
#define pa pair<int,int>
#define ferma(a,b) pow(a,b-2)
#define pb push_back
#define all(x) x.begin(),x.end()
#define memset(a,b) memset(a,b,sizeof(a));
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
void file()
{
#ifdef ONLINE_JUDGE
#else
freopen("cin.txt","r",stdin);
// freopen("cout.txt","w",stdout);
#endif
}
int get(int num)
{
return 1<<num;
}
signed main()
{
IOS;
//file();
int n;
cin>>n;
vector<int>a(n),b(n);
for(auto &it:a)
cin>>it;
int ans=0;
for(int i=0;i<26;++i)
{
int mod=get(i+1);
for(int j=0;j<n;++j)
b[j]=a[j]%mod;
long long sum=0;
sort(all(b));
for(int j=0;j<n;++j)
{
int l=lower_bound(all(b),get(i)-b[j])-b.begin();
int r=upper_bound(all(b),get(i+1)-1-b[j])-b.begin()-1;
sum+=r-l+1;
l=lower_bound(all(b),get(i)+get(i+1)-b[j])-b.begin();
r=upper_bound(all(b),get(i+2)-2-b[j])-b.begin()-1;
sum+=r-l+1;
if((b[j]*2)&get(i))
sum--;
}
if(sum/2%2)
ans+=get(i);
}
cout<<ans<<endl;
return 0;
}