N = int(input())
A = [int(val) for val in input().split(' ')]
sum_ = 0
for i in range(N):
    for j in range(i+1, N):
        print(A[i] ^ A[j])
        sum_ += A[i] ^ A[j]
div = 10**9 + 7
print(sum_  % div)