mod = 10 ** 9 + 7

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

N = int(input())
A = list(map(int, input().split()))

L = [0] * 60

for i in range(N):
	tmp = Base_10_to_n(A[i],2).rjust(60,"0")
	for j in range(60):
		if tmp[j] == "1":
			L[j] += 1

ans = 0
binary = 1
for i in range(60):
	ans += (L[-(i+1)]%mod) * ((N-L[-(i+1)])%mod) * binary 
	ans %= mod
	binary *= 2
	binary %= mod

print(ans%mod)