# coding: utf-8
n_integer = int(input())
integers = [int(x) for x in input().split(' ')]
sum_of_exclusiveor = 0

for i in range(n_integer - 1):
    for j in range(n_integer - 1 - i):
        sum_of_exclusiveor += integers[i] ^ integers[i+j+1]
        
print(sum_of_exclusiveor % (10**9 + 7))