N = int(input())
A = [int(i) for i in input().split()]
mod = 10**9 + 7

ans = 0
for b in range(60):
    c = 0
    for a in A:
        if (a >> b) & 1:
            c += 1
    ans += 2**b*c*(N-c)
    ans %= mod
print(ans)
