x = int(input())
a = list(map(int, input().strip().split()))
s = 1e9+7
list1=[]
for i in range(0, x-1 ):
    for j in range(i + 1, x):
        list1.append(a[i]^a[j])
Sum = 0
for i in list1:
    Sum += i
    
print(int(Sum%s))
