#include<bits/stdc++.h> using namespace std; #define REP(i, n) for(int i = 0; i < (n); i++) #define FWD(i, a, b) for(int i = (a); i < (b); i++) using LL = long long; const int N = 36; LL a[N]; void getxors(unordered_map<LL, int> &xors, int i, int j, LL mask){ if(j-i == 1){ xors[mask ^ a[i]]++; return; } getxors(xors, i+1, j, mask ^ a[i]); a[i+1] += a[i]; getxors(xors, i+1, j, mask); a[i+1] -= a[i]; } LL solve(int n){ if(n == 1) return a[0] == 0 ? 1 : 0; int k = n/2; unordered_map<LL, int> lxors; getxors(lxors, 0, k, 0); unordered_map<LL, int> rxors; getxors(rxors, k, n, 0); /*REP(i, n) cout << a[i] << " "; cout << endl; cout << 0 << " " << k << " " << n << endl; for(auto kv : lxors){ cout << kv.first << " " << kv.second << endl; } cout << "===" << endl; for(auto kv : rxors){ cout << kv.first << " " << kv.second << endl; } cout << endl;*/ LL res = 0; for(auto kv : lxors){ res += rxors[kv.first] * kv.second; } a[k-1] += a[k]; FWD(i, k, n-1) a[i] = a[i+1]; return res + solve(n-1); } int main(){ int n; assert(scanf("%d", &n) == 1); REP(i, n){ scanf("%lld", &a[i]); } printf("%lld\n", solve(n)); return 0; }