N = int(input())
A = list(map(int, input().split()))
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

A_max = max(A)
L = len(Base_10_to_n(A_max, 2))

bit_zero = [0]*L
bit_one = [0]*L

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

ans = 0
for i in range(L):
	zero = bit_zero[i] % mod
	one = bit_one[i] % mod
	c = (zero * one) % mod
	t = 1
	for _ in range(L-i-1):
		t *= 2
		t %= mod
	ans += (c*t) % mod
	ans %= mod
print(ans)