N = int(input())
A = list(map(int, input().split()))

out = 0
mod = 10**9 + 7 
for i in range(N-1):
    A_i = A[i]
    for j in range(i+1, N):
        A_j = A[j]
        out += A[i]^A[j]
        out = out % mod
print(out)