import sys
input = sys.stdin.readline

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

mod = 10 ** 9 + 7
ans = 0

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

print(ans)
