n=int(input())
A=list(map(int,input().split()))
l=[0]*60
for i in range(60):
    for j in range(n):
        l[i]+=A[j]%2
        A[j]//=2  
ans=0
k=1
for i in range(60):
    ans=(ans+k*l[i]*(n-l[i]))%1000000007
    k=(k*2)%1000000007
print(ans)