n = int(input())
A = list(map(int, input().split()))
B = list()
ans = 0
for i in range(n - 1):
    for j in range(n - i - 1):
        b = A[i] ^ A[j + i + 1]
        B.append(b)
for i in range(len(B)):
    if ans + B[i] < 1000000007:
        ans += B[i]
    else:
        ans = (ans + B[i]) % 1000000007
print(ans)