n = int(input())
A = list(map(int, input().split()))

mod = 10**9+7
ans = 0

for k in range(60):
    x, y = 0, 0
    for a in A:
        if a & 1<<k:
            x += 1
    ans += x*(n-x)*pow(2, k, mod)
    ans %= mod
print(ans)