import numpy as np
mod=10**9+7
n=int(input())
A=list(map(int,input().split()))
A=np.array(A)

ans=0
for i in range(60):
    count_1=len([i for i in A if i%2==1])
    ans +=2**i*count_1*(n-count_1)
    A >>=1

print(ans%mod)