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