N=int(input())
A=list(map(int,input().split()))
MOD=10**9+7
ans=0
for i in range(61):
    a,b=0,0
    for j in range(N):
        if A[j]%2==0:
            a+=1
        else:
            b+=1
        A[j]=A[j]//2
    ans=(ans+(a*b)*2**i)%MOD
print(ans)