#include <bits/stdc++.h>   using namespace std;   using ll = long long int;   int main() {     ll n;     cin >> n;     vector<ll> a(n + 1);     ll curr = 0;     vector<ll> iseven(2);     ll ans = 0;     for (int i = 1; i <= n; i++) {       ll x;       cin >> x;       x = __builtin_popcountll(x);       a[i] = x;       curr = (curr + x) % 2;       ans += iseven[curr];       if (i > 1) {         if (curr == 0) ans++;         if (x % 2 == 0) ans--;       }       iseven[curr]++;     }     for (ll i = 1; i <= n; i++) {       ll maxi = a[i];       ll sum = a[i];       for (ll j = i - 1; j >= max(1ll, i - 62); j--) {         sum += a[j];         maxi = max(maxi, a[j]);         if (sum % 2 == 0 && 2 * maxi > sum) {           ans--;         }       }     }     cout << ans << endl;   }   