mod = pow(10,9)+7
N = int(input())

A =map(lambda x:int(bin(int(x))[2:]) ,input().split())

counter = 0
for a in A:
    counter += a

A = str(counter)
L = len(A)
tmp = 0
for i in range(L):
    tmp += int(A[i])*(N-int(A[i]))*2**(L-i-1)
    tmp %= mod
print(tmp)