N = int(input())
A = [int(i) for i in input().split()]
SUM = 0
DIV = 10**9 + 7

for i in range(1,N):
    for j in range(i+1,N+1):
        XOR = A[i-1]^A[j-1]#XOR
        SUM = SUM + XOR
if SUM < DIV:
    print(SUM)
else:
    print(SUM%DIV)