import sys
N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
S = 0
MOD = 1000000007

for i in range(N - 1):
    for j in range(i + 1, N):
        S += A[i] ^ A[j]
        S = S % MOD

print(S)