N=int(input())
A=list(map(int,input().split()))
A=[bin(a)[2:].zfill(60) for a in A]
ans=0
mod=10**9+7
for k in range(60):
    count=sum([int(a[k]) for a in A])
    ans+=count*(N-count)*(2**(60-k-1))
print(ans%mod)
