N = int(raw_input())
s = raw_input().split()
A = [0 for i in range(N)]
for i in range(N):
    A[i] = int(s[i])

#print A

M = 1000000007

#print M

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

print xor % M
