#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
#include <set>
#include <iterator>
using namespace std;
using namespace __gnu_pbds;
 
 
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()
 
#define ll long long int
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) for(int i=0;i<v.size();i++) cout << v[i] << " " ;
 
#define f_in(st) freopen(st,"r",stdin)
#define f_out(st) freopen(st,"w",stdout)
 
#define INF INT_MAX
#define matrix vector<vector<ll> >
 
#define fr(i, a, b) for(i=a; i<=b; i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define ASST(x, l, r) assert( x <= r && x >= l )
#define maxbits 22
#define maxmask (1ll<<maxbits)
typedef tree<pll, null_type, less<pll>, rb_tree_tag,
             tree_order_statistics_node_update>
    new_data_set;
const int  N=100000 +10, M=(ll)1e9+1 ;
 const int mod =(ll)1e9+7,sz=5 ;
string s1="Alice",s2="Bob";
void work(){
   ll n;
   cin >> n;
   vl a(n),b(n);
   for(ll i=0;i<n;i++){
        cin >> a[i];
        b[i]=__builtin_popcountll(a[i]);
   }
   ll cnt[2][n+1],res=0;
   cnt[0][n]=1;
   cnt[1][n]=0;
   ll ans=0,sufsum=0;
   for(ll i=n-1;i>=0;i--){
    ll sum=0,mx=-1;
    sufsum+=b[i];
    for(ll j=i;j<n && (j-i) < 65 ;j++){
        sum+=b[i];
        mx=max(mx,b[i]);
        if(sum%2==0 && mx > (sum-mx))
            --ans;
    }
    cnt[0][i]=cnt[0][i+1];
    cnt[1][i]=cnt[1][i+1];
    ans+=cnt[sufsum&1][i];
    cnt[sufsum&1][i]++;
   }
    cout << ans << '\n';
}
int main(){
 ios_base::sync_with_stdio(0);
 cin.tie(0);
    ll t;
//    cin >> t;
    t=1;
    while(t--){
            work();
    }
   return 0;
 
}