import numpy as np
MOD = 1000000007
N = int(input())
A = list(map(lambda x:bin(int(x)).split('b')[1].zfill(60),input().split()))
B = np.array([0]*60)
for i in range(N):
    B += np.array(list(map(int,list(A[i]))))

C = list(B)

D = 0
for i in range(60):
    D += C[i]*(N-C[i])*(2**(59-i))%MOD

print(D)