M=10**9+7
N=int(input())
la=list(map(int,input().split()))
ans=0
for i in range(60):
    n0=0
    n1=0
    for j in range(N):
        if la[j]&1:
            n1+=1
        else:
            n0+=1
        la[j]>>=1
    ans=(ans+n0*n1%M*(2**i%M))%M
print(ans)
