
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(len(list)):
    for j in range(len(list)):
        if i < j:
            sum += list[i]^list[j]

print(sum % 1000000007)
    