div = 10**9 + 7
ans = 0

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

for i in range(N):
    for j in range(i,N):
        #print(str(i) + " : " + str(j))
        ans += A[i]^A[j]

#print(ans)
print(ans%div)
