N = int(input())
A = list(map(int, input().split()))
mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    cnt = 0
    for a in A:
        x = bin(a)[2:][::-1]
        if not i < len(x):
            continue
        b = int(x[i])
        if b == 1:
            cnt += 1
    ans += cnt * (N - cnt) * pow(2, i)
    ans %= mod
print(ans)