n=int(input())
table=[0]*60
for v  in map(int,input().split()):
    for j in range(60):
        if v%2:table[j]+=1
        v//=2
        if v==0:break
ans=0
mod=10**9+7
a=1

for o in table:
    z=(n-o)
    ans=(ans+o*z%mod*a)%mod
    a=a*2%mod
print(ans)