P = 10**9 + 7

N = int(input())
A = [int(x) for x in input().split()]

X = [[0,0] for _ in range(60)]
for k in range(60):
    for i in range(N):
        b = (A[i] >> k) & 1
        X[k][b] += 1

S = 0
pow2 = 1
for k in range(60):
    S = (S + pow2 * X[k][0] * X[k][1]) % P
    pow2 = 2 * pow2 % P

print(S)