#include <cstdio> #include <algorithm> using namespace std; typedef int ll; ll b[1000000]; ll calc(int n, ll a[]) { ll ret = 0; if (n == 1) { if (a[0] == 0) return 1; return 0; } int m = n / 2, tt = 0; int k = n - m; ll temp = a[0]; for (int i = 0; i < (1 << (m - 1)); i++) { ll xtemp = 0; temp = a[0]; for (int j = 1; j < m; j++) { if ((1 << (j - 1)) & i) { temp += a[j]; } else { xtemp = xtemp ^ temp; temp = a[j]; } } xtemp = xtemp ^ temp; b[tt++] = xtemp; } b[tt++] = 2000000000; sort(b, b + tt); for (int i = 0; i < (1 << (k - 1)); i++) { ll xtemp = 0; temp = a[m]; for (int j = 1; j < k; j++) { if ((1 << (j - 1)) & i) { temp += a[m + j]; } else { xtemp = xtemp ^ temp; temp = a[m + j]; } } xtemp = xtemp ^ temp; int i1 = lower_bound(b, b + tt, xtemp) - b; if (b[i1] == xtemp) { int i2 = lower_bound(b, b + tt, xtemp + 1) - b; if (b[i2] != xtemp) i2--; ret += (i2 - i1 + 1); } } a[m - 1] += a[m]; for (int i = m; i < n; i++) a[i] = a[i + 1]; return ret + calc(n - 1, a); } int main() { int n; ll a[40]; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]); printf("%d\n", calc(n, a)); return 0; }