N = int(input())
A = list(map(int, input().split()))
ans = 0
t = 0
u = 0
for i in range(60):
    if max(A) >= 2**i:
        u += 1
    else: break
for i in range(u):
    for j in range(N):
        if A[j] >= 2 ** i:
            t += ((A[j]%(2**(i+1)))//(2**i))
    ans += (t * (N-t)) * 2**i
    t = 0
print(ans%1000000007) 