N = int(input())
A = list(map(int,input().split()))
MOD = 10**9 + 7
base = sum(A) % MOD

b = 1
b2 = 1
ans = (base * N) % MOD
for i in range(60):
	s = 0
	k = 0
	for a in A:
		if (a // b) % 2 == 1:
			k -= 1
			s += 1
		else:
			k += 1
	ans = (ans + ((b2 * s * k) % MOD)) % MOD
	b2 = b2 * 2 % MOD
	b = b * 2
# divide 2
ans = (ans * ((MOD + 1) // 2)) % MOD
print(ans)