N = int(input())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7
lst = [0 for _ in range(70)]

# fac[i] = i!
# inv[i] = iの逆元

fac = [1]
inv = [1]

for i in range(1, N + 10) :
	fac.append(fac[-1] * i % MOD)
	inv.append(pow(fac[-1], MOD - 2, MOD))

for a in A:
	cur = bin(a)
	ctr = 0
	for i in reversed(range(len(cur))):
		if cur[i] == "b": break
		else:
			lst[ctr] += int(cur[i])
		ctr += 1
			
ans = 0

for i in range(len(lst)):
	ans += lst[i] * (2 ** i) * (N - 1) % MOD

for i in range(len(lst)):
	if lst[i] == 0: continue
	ans -= (2 ** i) * (fac[lst[i]] * inv[lst[i] - 2] * inv[2]) * 2 % MOD
	ans %= MOD
	
print(ans)