N = int(input())
A = input().split()
A = [int(a) for a in A]

sum_ = 0
for i in range(len(A)-1):
    for j in range(i+1,len(A)):
        sum_ += A[i]^A[j]
        sum_ = sum_%1000000007
        
print(sum_)