import time

def add(a,b):
  return (a ^ b) % 1000000007

####
N = int(input())
A =  list(map(int,input().split()))

###
ans2 = [add(A[y],A[x]) for y in range(N) for x in range(y+1,N)]
print(sum(ans2)%1000000007)
###

#出力
#print(N)
#print(A)
#print(' ')
#print(sum)