import sys
input=sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n):
    ai=a[i]
    for j in range(61):
        if (ai>>j)&1:
            b[i]+=1
cnt=[[0]*(n+1) for i in range(2)]
cnt[0][n]=1
res=0
suf=0
for i in range(n)[::-1]:
    s=0;MAX=0
    add=0
    for j in range(i,n):
        if j-i>=65:
            break
        s+=b[j]
        MAX=max(MAX,b[j])
        if MAX>s-MAX and s%2==0:
            add-=1
    suf+=b[i]
    add+=cnt[suf&1][i+1]
    res+=add
    cnt[0][i]=cnt[0][i+1]
    cnt[1][i]=cnt[1][i+1]
    if suf&1:
        cnt[1][i]+=1
    else:
        cnt[0][i]+=1
print(res)