#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;

typedef long long int ll;
#define inf 998244353
#define INF 10000000000000000
#define pii pair<int,int>
#define vi vector<int> 
#define vl vector<ll> 
#define pb push_back 
#define sz(x) int(x.size())
#define F first 
#define S second
#define N 300005
#define ld long double

using namespace __gnu_pbds;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> howle;

ll a[N];
ll p[N] = {0};
ll e[N] = {0};
int main() {
   int n;
   cin >> n;
   for(int i = 0; i < n; i++) cin >> a[i];
   for(int i = 0; i < n; i++) a[i] = __builtin_popcountll(a[i]);
   for(int i = 0; i < n; i++) {
        p[i+1] = p[i] + a[i];
        e[i+1] = e[i];
        if(p[i+1]%2 == 0) e[i+1]++;
    }
    ll ans = 0;
    for(int i = 0 ; i < n; i++) {
        ll sum = 0;
        set<ll> s;
        for(int j = i; j < min(i + 65,n); j++) {
            //cout << "sum = " << sum << "\n";
            sum += a[j];
            s.insert(a[j]);
            if(sum >= 2LL*(*s.rbegin())  && sum%2 == 0) {
                ans ++;
                 //cout << "sum = " << sum << " i = " << i << " j = " << j << "\n";
            }
        }
        ans += e[n] - e[min(i+65,n)];
    }
    cout << ans << "\n";

}