N = int(input())
*A, = map(int, input().split())
ans = 0
B = [0] * 61
for k, a in enumerate(A):
    la = list(bin(a))[2:]
    j = 0
    for i in range(61-len(la), 61):
        B[i] += int(la[j])
        j += 1

ans = 0
mod = 10**9 + 7
for i, b in enumerate(B):
    ans += b * (len(A)-b) * 2**(60-i) % mod
print(ans % mod)
