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