#include <bits/stdc++.h> #define gcd __gcd #define bitcount __builtin_popcountll #define getcx getchar_unlocked #define rep(i,j,n) for(i=j;i<n;i++) #define tr(it,c) for(auto it=(c).begin();it!=(c).end();it++) #define pb push_back #define mp make_pair #define uset unordered_set #define umap unordered_map #define fi first #define sc second using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pi; typedef pair<ll,ll> pill; const ll hell = 1000000007LL; const ll INF = hell*hell; const int MAXN = 37; vector<ll> a; umap<ll,ll> u; ll solve(vector<ll> &a, bool flag){ ll res = 0, i,j,N=a.size(); rep(i,0,(1LL<<(N-1LL))){ ll mask = i,ans=0, temp = 0; rep(j,0,N-1){ temp+=a[N-1-j]; if(!(mask&1LL)){ ans^=temp; temp=0; } mask>>=1LL; } temp+=a[0]; ans^=temp; if(flag) res+=u[ans]; else u[ans]++; } return res; } int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); ll res = 0, N, i,j; cin>>N; a.resize(N); rep(i,0,N) cin>>a[i]; j = N; vector<ll> x,y; rep(i,0,(j+1)/2) x.pb(a[i]); rep(i,(j+1)/2,j) y.pb(a[i]); rep(i,0,N-1){ u.clear(); solve(y,false); res+=solve(x,true); //cerr<<"Debug "<<endl; //tr(it,x) cerr<<*it<<" "; //cerr<<endl; //tr(it,y) cerr<<*it<<" "; //cerr<<endl; if(x.size()!=y.size()){ auto temp = x.back(); x.pop_back(); if(y.size()) y[0]+=temp; }else{ x[x.size()-1]+=y[0]; y.erase(y.begin()); } } cout<<res; }