# problem D
mod=10**9+7

N=int(input())
A=list(map(int,input().split()))

b=[[0 for i in range(N)] for k in range(60)] # i番目の数の2^kの位(0<=k<60)

for i in range(N):
    for k in range(60):
        b[k][i]=A[i]>>k&1

ans=0
for k in range(60):
    ans+=2**k*b[k].count(0)*b[k].count(1)

print(ans%mod)