N = int(input())
L = [[0 for i in range(N)] for j in range(60)]
As = map(int, input().split())
mod = 1000000007
ans = 0
index = 0

for A in As:
    tmp = format(A, 'b').zfill(60)
    for j in range(60):
        L[j][index] = int(tmp[j])
    index += 1

acc = 1
tmps = []
for i in range(60):
    tmps.append(acc)
    acc = acc * 2 % mod

for i in range(60):
    tmp = tmps[-(i + 1)]
    a = sum(L[i]) % mod
    b = (N - a) % mod
    ans += (tmp * a * b) % mod

ans = ans % mod
print(ans)
