n = int(input())
mod = 1000000007
a = []
for i in input().split():
    a.append(int(i))

ans = 0
for i in range(60):
    x = 0
    for j in range(n):
        if (a[j]>>i&1):
            x += 1
    now = x * (n - x) % mod
    for j in range(i):
        now = now * 2 % mod
    ans += now
    ans %= mod

print(ans)