N = int(input())
A = list(map(int, input().split()))
MOD = 1000000007
answer = 0
for i in range(1, N - 1 + 1):
    for j in range(i + 1, N + 1):
        answer += A[i - 1] ^ A[j - 1]
print(answer % MOD)