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]
        if ans + b < 1000000007:
            ans += b
        else:
            ans = (ans + b) % 1000000007
print(ans)