N = int(input())
Alist = list(map(int, input().split()))
ans = 0
MOD = 10**9 + 7
for i in range(N - 1):
    A_i = Alist[i]
    for j in range(i + 1, N):
        ans += A_i ^ Alist[j]
        ans %= MOD
print(ans)
