MOD = 10 ** 9 + 7

n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(60):
    x = 0
    now = 0
    for j in range(n):
        if (a[j] >> i) & 1:
            x += 1
        now = x * (n - x) % MOD
    now = now * (2 ** i) % MOD
    ans = (ans + now) % MOD

print(ans)
