N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
C = [0] * 60
for a in A:
    for i in range(60):
        if a>>i&1:
            C[i] += 1
ans = 0
for i, c in enumerate(C):
    ans += (1<<i) * c * (N-c) % mod
print(ans % mod)
