import sys
read = sys.stdin.read

N, *A = map(int, read().split())
mod = 10 ** 9 + 7
answer = 0

for i in range(N - 1):
    for j in range(i + 1, N):
        answer += A[i] ^ A[j]
        answer %= mod

print(answer)