n=int(input())
A=list(map(int,input().split()))
B=[0]*62
mod=10**9+7

for i in range(n):
    a=bin(A[i])[2:]
    for j in range(len(a)):
        B[-j-1]+=int(a[-j-1])
ans=0
cnt=1
for b in range(len(B)):
    prd=B[-b-1]*(n-B[-b-1])
    ans+=prd*cnt%mod
    cnt*=2
    ans%=mod
    cnt%=mod
print(ans)