N = int(input())
A = tuple(map(int,input().split()))
b = 0
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
if b >= num:
    print(b%num)
else:
    print(b)
