#include <bits/stdc++.h> using namespace std; typedef long long ll; #define gc getchar_unlocked int getint() { unsigned int c; int x = 0; while (((c = gc()) - '0') >= 10) { if (c == '-') return -getint(); if (!~c) exit(0); } do { x = (x << 3) + (x << 1) + (c - '0'); } while (((c = gc()) - '0') < 10); return x; } int getstr(char *s) { int c, n = 0; while ((c = gc()) <= ' ') { if (!~c) exit(0); } do { s[n++] = c; } while ((c = gc()) > ' ' ); s[n] = 0; return n; } template<class T> inline bool chmin(T &a, T b) { return a > b ? a = b, 1 : 0; } template<class T> inline bool chmax(T &a, T b) { return a < b ? a = b, 1 : 0; } typedef unsigned long long Hash; const Hash BASE = 999999937; template<class Value> struct Map { static const int M = 60 * 1000000; // memory limit static const int E = sizeof(Hash) + sizeof(bool) + sizeof(Value), N = M / E; int n; Hash h[N]; bool u[N]; Value v[N]; Map() { clear(); } void clear() { n = 0, memset(u, 0, sizeof(u)); } int size() { return n; } // return 1 : if inserted, 0 : already there bool set(Hash x, Value value) { int i = x % N; for (; u[i]; ++i != N ?: i = 0) if (h[i] == x) { v[i] = value; return 0; } h[i] = x, u[i] = 1, v[i] = value, n++; return 1; } // return 1 : if found, 0 : could not find bool get(Hash x, Value & res) { for (int i = x % N; u[i]; ++i != N ?: i = 0) if (h[i] == x) { res = v[i]; return 1; } return 0; } Value get(Hash x) { for (int i = x % N; u[i]; ++i != N ?: i = 0) if (h[i] == x) return v[i]; return Value(); } bool count(Hash x) { for (int i = x % N; u[i]; ++i != N ?: i = 0) if (h[i] == x) return 1; return 0; } }; template<class T> struct BIT { vector<T> as; void init(int n, T u = 0) { as.assign(n, u);} T sum(int s, int e) { return sum(e) - sum(s - 1);} T sum(int e) { T s = 0; for (; e >= 0; e = (e & e + 1) - 1) s += as[e]; return s; } void add(int p, T v) { for (; p < as.size(); p |= p + 1) as[p] += v; } }; BIT<ll> bit; int n; ll as[111]; ll mhs(ll now, int pos) { return now * 100 + pos; } Map<ll> cache; int solve(ll now, int pos) { if (pos == n) { if (now == 0) return 1; return 0; } ll key = mhs(now, pos); if (cache.count(key)) return cache.get(key); int res = 0; for (int i = pos; i < n; i++) { ll nxt = now, add = bit.sum(pos, i); /* for (int j = pos; j <= i; j++) { add += as[j]; } */ nxt ^= add; int tmp = solve(nxt, i + 1); // cout << now << ", " << nxt << ", " << pos << " " << i << " " << tmp << endl; res += tmp; } cache.set(key, res); return res; } int main () { int i, j, tcc, tc = 1 << 28; for (tcc = 0; tcc < tc; tcc++) { n = getint(); bit.init(n); for (i = 0; i < n; i++) as[i] = getint(), bit.add(i, as[i]); int res = solve(0, 0); cout << res << endl; } return 0; }