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

l = (10 ** 9) + 7

res = 0
res = [ [A[i], A[j] ] for i in range(0,N-1) for j in range(i, N)]
a = list(map(lambda x: x[0] ^ x[1] , res))


print(sum(a) % l)