n=int(input())
b=list(map(int,input().split()))
pre=[0]
for j in range(n):
    pre.append(pre[-1]+bin(b[j]).count('1'))

ans=0
e=0
o=0
for j in range(n+1):
    if pre[j]%2==0:
        ans+=e
        e+=1
    else:
        ans+=o
        o+=1

print(ans)
