#include <bits/stdc++.h>   using namespace std;   const long long maxn = 1e6 + 666;   long long saveori[maxn];   long long save[maxn];   long long getcnt(long long x) {     long long cnt = 0;     while (x) {       if (x & 1) cnt++;       x = x >> 1;     }     return cnt;   }   long long cnt[maxn][2];   long long pre[maxn];   signed main() {     long long n;     cin >> n;     for (long long i = 1; i <= n; i++) {       scanf( %lld , &saveori[i]);       save[i] = getcnt(saveori[i]);     }     long long sum = 0;     for (long long i = 1; i <= n; i++) {       cnt[i][0] = cnt[i - 1][0];       cnt[i][1] = cnt[i - 1][1];       cnt[i][sum % 2]++;       sum += save[i];       pre[i] = sum;     }     long long ans = 0;     for (long long i = n; i >= 1; i--) {       long long maxval = -1;       sum = 0;       for (long long j = i; j >= i - 64 && j > 0; j--) {         sum += save[j];         maxval = max(maxval, save[j]);         if (maxval * 2 <= sum && sum % 2 == 0) {           ans++;         }       }       if (i - 65 >= 1) {         ans += cnt[i - 65][pre[i] % 2];       }     }     cout << ans << endl;   }   