#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3fffffff;   const int SINF = 0x7fffffff;   const long long LINF = 0x3fffffffffffffff;   const long long SLINF = 0x7fffffffffffffff;   const int MAXN = 300007;   const int MAX = 130;   int n;   int a[MAXN];   int ps[MAXN];   int pc[MAXN][2];   void init();   void input();   void work();   int main() {     init();     input();     work();   }   void init() { ios::sync_with_stdio(false); }   void input() {     scanf( %d , &n);     long long x;     for (int i = 1; i <= n; ++i) {       scanf( %I64d , &x);       a[i] = __builtin_popcountll(x);     }   }   void work() {     for (int i = 1; i <= n; ++i) ps[i] = ps[i - 1] + a[i];     int mx;     long long ans = 0;     for (int i = 1; i <= n; ++i) {       int j = i - 1;       mx = a[i];       for (; j && i - j <= MAX; --j) {         mx = (((mx) > (a[j])) ? (mx) : (a[j]));         if ((ps[i] & 1) == (ps[j - 1] & 1) && mx * 2 <= ps[i] - ps[j - 1]) ++ans;       }       ans += pc[j][ps[i] & 1];       pc[i][0] = pc[i - 1][0], pc[i][1] = pc[i - 1][1];       ++pc[i][ps[i - 1] & 1];     }     cout << ans << endl;   }   