N=int(input())
A=list(map(int,input().split()))
L=[0]*60
for i in range(N):
    l=list(map(int,format(A[i],'b')))
    for i in range(len(l)):
        if l[len(l)-i-1]==1:
            L[i]+=1
v=0
sum=0
def power(a,n):
    x=1
    L=list(format(n,'b'))
    l=len(L)
    for i in range(l):
        if int(L[l-i-1])==1:        
            x=(x*a)%(10**9+7)
        a=(a*a)%(10**9+7)
    return x
for i in range(60):
    sum+=L[i]*(N-L[i])*power(2,v)
    v+=1
print(sum%(10**9+7))
    

