N=int(input())
A=list(map(int,input().split()))
P=10**9+7
ans=0
BIN=[0]*N
for h in range(N):
    BIN[h]=bin(A[h])[2:].zfill(60)

for i in range(60):
    inc=0
    one=0
    zero=0
    for j in range(N):
        if BIN[j][59-i]=="0":
            zero+=1
        else:
            one+=1
    ans+=zero*one*2**i
print(ans%P)
