Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int c[1048576],d[1048576];
- int main(){
- int k;
- for( k=0;k<1048576;k++){
- c[k]=0;
- d[k]=0;
- }
- int n;
- long long otvet;
- otvet=0;
- cin>>n;
- long long a[n],b[n],i,j;
- for (i=0;i<n;i++){
- cin>>a[i];
- }
- b[0]=a[0];
- c[b[0]]+=1;
- for (i=1;i<n;i++){
- b[i]=b[i-1]^a[i];
- if (i%2==0){
- c[b[i]]+=1;
- }
- else{
- d[b[i]]+=1;
- }
- }
- otvet=d[0];
- for(i=0;i<1048576;i++){
- otvet=otvet+c[i]*(c[i]-1)/2+d[i]*(d[i]-1)/2;
- }
- cout<<otvet;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement