N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
 
for i in range(N): A[i] = format(A[i], "#b") #ここで全て60ビットの二進数に変換
#print(A)

sum = 0
c0 = [0]*60
c1 = [0]*60
for i in range(N):
    for j in range(60):
        if A[i][-(j+1)] == "0": #str型であることに注意！
            c0[j] += 1
        elif A[i][-(j+1)] == "1":
            c1[j] += 1
        else:
            break
 
for i in range(60):
    if c1[i] > 0:
        c0[i] = N - c1[i] 
    sum += (c0[i] * c1[i]) << i
    sum %= mod
 
print(sum%mod)