N = int(input())
A = list(map(int,input().split()))
B = [[0 for i in range(len(A))] for j in range(len(A))]
for i in range(len(A)):
    for j in range(i+1,len(A)):
        B[i][j] = A[i]^A[j]

ans = 0
for i in range(len(A)):
    ans += sum(B[i])
bk = int(1e9+7)
ans = ans%bk
print(ans)