MOD = 10**9 + 7
n = int(input())
a = [int(i) for i in input().split()]
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)