lim=10**9+7
H=int(input())
A=[int(i) for i in input().split()]

#M=[[0]*H for _ in range(H)]
#K=[[0]*H for _ in range(H)]
for N in range(0,H+1):
    sum_=0
    sum2=0
    for i in range(N):
        for j in range(i+1,N):
            #M[i][j]=A[i]^A[j]
            #K[i][j]=A[i]+A[j]
            sum_ = (sum_+(A[i]^A[j])) % lim
            #sum2 = (sum2+(A[i]+A[j])) 
print(sum_)
#print(sum2)
#print(sum2-sum_)
#print("###")