#include <cstdlib> #include <cctype> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> #include <string> #include <iostream> #include <sstream> #include <map> #include <set> #include <queue> #include <stack> #include <fstream> #include <numeric> #include <iomanip> #include <bitset> #include <list> #include <stdexcept> #include <functional> #include <utility> #include <ctime> using namespace std; typedef long long LL; #define rep(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++) int n; int a[100]; int b[40]; map<int,int> mem[20]; int main() { //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); cin>>n; for (int i=0; i<n; i++) cin>>a[i]; long long res = 0; /* for (int i=0; i<(1<<(n-1)); i++) { int cnt = 0; b[cnt++] = a[n-1]; for (int j=n-2; j>=0; j--) { if ((1<<j)&i) { b[cnt-1] += a[j]; } else { b[cnt++] = a[j]; } } int tmp = 0; for (int j=0; j<cnt; j++) tmp ^= b[j]; if (tmp==0) res++; } int tmp = res; */ res = 0; int m = n/2; for (int k=0; k<=m; k++) { if (k==0) { mem[0][0] = 1; continue; } if (k==1) { mem[1][a[0]] = 1; continue; } for (int i=0; i<(1<<(k-1)); i++) { int cnt = 0; b[cnt++] = a[k-1]; for (int j=k-2; j>=0; j--) { if ((1<<j)&i) { b[cnt-1] += a[j]; } else { b[cnt++] = a[j]; } } int tmp = 0; for (int j=0; j<cnt; j++) tmp ^= b[j]; mem[k][tmp]++; } } int t = n - m; for (int i=0; i<(1<<(t-1)); i++) { int cnt = 0; b[cnt++] = a[n-1]; for (int j=n-2; j>=m; j--) { if ((1<<(j-m))&i) { b[cnt-1] += a[j]; } else { b[cnt++] = a[j]; } } int tmp = 0; for (int j=0; j<cnt; j++) tmp ^= b[j]; res += mem[m][tmp]; } for (int k=m; k<n; k++) { for (int l=m-1; l>=0; l--) { int tot = 0; for (int j=l; j<=k; j++) { tot += a[j]; } t = n - k - 1; if (t == 0) { res += mem[l][tot]; continue; } for (int i=0; i<(1<<(t-1)); i++) { int cnt = 0; b[cnt++] = a[n-1]; for (int j=n-2; j>=k+1; j--) { if ((1<<(j-k-1))&i) { b[cnt-1] += a[j]; } else { b[cnt++] = a[j]; } } int tmp = 0; for (int j=0; j<cnt; j++) tmp ^= b[j]; res += mem[l][tmp^tot]; } } } cout<<res<<endl; return 0; }