n=int(input())
numbers=input().split()
nm=list(map(int,numbers))
#print(nm)
sums=0
for i in range(0,n-1):
    for j in range(i+1,n):
        #print(nm[i],end=" ")
        #print(nm[j])
        sums+=nm[i]^nm[j]
#print(sums)
print(sums%1000000007)