N = int(input())
A = input().split()
total = 0

def calc(a,b):
	ans = int(bin(a^b),2)
	return ans
	
for i in range(N):
	for j in range(i+1,N):
		total += calc(int(A[i]),int(A[j]))
		
		
print(total % (1000000007))