import time

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

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

start = time.time()
###
ans2 = [add(A[y],A[x]) for y in range(N) for x in range(y+1,N)]
print(sum(ans2)%1000000007)
###
elapsed_time = time.time() - start
print ("2重for文time:{0}".format(elapsed_time) + "[sec]")


start = time.time()
###
ans2 = [(A[y] ^ A[x]) % 1000000007 for y in range(N) for x in range(y+1,N)]
print(sum(ans2)%1000000007)
###
elapsed_time = time.time() - start
print ("2重for文time:{0}".format(elapsed_time) + "[sec]")