n=int(input())
MOD=10**9+7
a=list(map(int,input().split()))
x=[0 for i in range(60)]
for i in range(n):
    s=(bin(a[i])[2:])[::-1]
    for j in range(len(s)):
        if s[j]=='1': x[j]+=1

ans=0
for i in range(60):
    ans+=( (n-x[i] )*x[i]*(2**i) ) %MOD
    ans=ans%MOD
print(ans)