N = int(input())
A = [int(a) for a in input().split()]


L = [0]*61

for i in range(N):
    b = bin(A[i])
    for j in range(2, len(b)):
        if b[j] == "1":
            L[len(b)-j-1] += 1

ans = 0
mod = 10**9+7

for i in range(61):
    c = 2**i*(L[i]*(N-L[i]))
    ans += c
    ans %= mod
    
print(ans)