n  = int(input())
m  = 10 ** 9 + 7
xs = [int(x) for x in input().split()]
bs = [0] * 61
b  = 1

for i in range(0, 61):
	c = 0
	
	for x in xs:
		if (x & b) != 0:
			c += 1
	
	bs[i] = c
	b   <<= 1

b = 1
r = 0

for i in range(0, 61):
	if 0 < bs[i] and bs[i] < n:
		r += ((n - bs[i]) * bs[i]) * b
		
	b <<= 1
	
print(r % m)
