n=int(input())
a=[int(i) for i in input().split()]

mod = 10**9+7

num = [0]*60

ans=0

for i in range(len(a)):
    for j in range(60):
        if((1<<j)&a[i]):
            num[j]+=1

for i in range(len(num)):
    po = (n-num[i])*(num[i])
    ans+=((po)*(pow(2,i,mod))%mod)

print(ans%mod)
    
