N=int(input())
A=[int(i) for i in input().split()]
ans=0
mod=10**9+7
for k in range(60):
    X=0
    Y=0
    for i in range(N):
        if A[i]^(2**k)>A[i]:
            X+=1
        else:
            Y+=1
    #print(X,Y)
    ans+=pow(2,k,mod)*(X*Y)
    ans%=mod
print(ans)
