MOD = 10**9 + 7
N = int(input())
A = list(map(int,input().split()))

B = [bin(a)[2:].zfill(61)[::-1] for a in A]
N1 = []
for i in range(0,61):
    m = 0
    for b in B:
        if b[i] == "1":
            m += 1
    N1.append(m)

ans = 0
for i,n1 in enumerate(N1):
    n0 = N-n1
    m = n0 * n1
    ans += 2**i * m
    ans = ans % MOD
print(ans % MOD)




