
n = int(input())
a = [int(i) for i in input().split()]
c = [0] * 63
for i in a:
	for j in range(0, 63):
		if (i & (1 << j)):
			c[j] += 1

ans = 0
for i in range(0, 63):
	ans += (1 << i) * (c[i] * (n - c[i]))

print(ans % (10**9 + 7))