N = int(input())
A = list(map(int,input().split()))
d = []
num = 10**9 + 7
for i in range(N-1):
    #print(i)
    for j in range(i+1,N):
        #print(j)
        b = A[i] ^ A[j]
        #b %= num
        d.append(b)
print(sum(d)%num)
