import operator
n = int(input())
a = list(map(int, input().split()))
sum = 0
for i in range(n -1):
	for j in range(i + 1, n) :
		sum += operator.xor(a[i], a[j])
if sum > 1000000007 :
	print(sum % 1000000007)
else :
	print(sum)