N = int(input())
As = list(map(int, input().split()))
modNum = 10**9 + 7
sum = 0
for d in range(60):
	n0 = 0
	n1 = 0
	for A in As:
		if (A >> d) & 1 == 1:
			n1 += 1
		else:
			n0 += 1
	sum += (1 << d) * n1 * n0
print(sum % modNum)