mod=10**9+7
n=int(input())
A=map(int,input().split())

cnt=[0]*60
for a in A:
    for j in range(60):
        cnt[j]+=a&1
        a>>=1

ans=0
b=1
for c in cnt:
    ans+=b*c*(n-c)
    ans%=mod
    b=b*2%mod

print(ans)