N = int(input())
L = [[] for i in range(60)]
As = list(map(int, input().split()))
mod = 1000000007
ans = 0
for i in range(N):
    tmp = format(As[i], 'b').zfill(60)
    for j in range(60):
        L[j].append(int(tmp[j]))

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)