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