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

mod = 10**9 + 7

ans = 0
for i in range(0, N - 1):
    for j in range(i + 1, N):
        # print(bin(A[i] ^ A[j]))
        # ans += int(bin(A[i] ^ A[j]), 0)
        ans += A[i] ^ A[j]
        ans %= mod
print(ans)
