#include<bits/stdc++.h> #define int long long usingnamespace std; int pre[2] = {1}, a[300005]; signedmain() { int n; scanf("%lld", &n); for (int i = 1; i <= n; i++) { int t; scanf("%lld", &t); a[i] = __builtin_popcountll(t); } int res = 0, sum = 0; for (int i = 1; i <= n; i++) { sum += a[i]; res += pre[sum & 1]; pre[sum & 1]++; int maxx = -1e9, num = 0; for (int j = i, t = 1; t <= 64 && j; j--, t++) { num += a[j]; maxx = max(maxx, a[j]); if ((num & 1 ^ 1) && (maxx << 1) > num) res--; } } printf("%lld", res); return0; }