N = int(input())
A = list(map(int,input().split()))
B = [None for k in range(N)]
for k in range(N):
	B[k] = format(A[k], '060b')
c = 0
for k in range(60):
	t = 0
	f = 0
	for s in range(N):
		if B[s][k] == '1':
			t +=1
		else:
			f +=1
	c += (t*f*(2**(59-k)))%(10**9+7)
print(c%(10**9+7))