
sum = 0
num = input()
list = [int(i) for i in input().split()]

#list2 = [3,1,4,1,5,9,2,6,5,3]
#list2 = [1,2,3]

for i in range(num):
    for j in range(i+1,num):
        sum += list[i]^list[j]
print(sum % 1000000007)
    