def add(a,b):
    mod=1000000007
    return (a+b)%mod

a=int(input())
b=list(map(int,input().split()))
s=0
count=0
for i in range(len(b)-1):
  for j in range(i+1,len(b)):
    if count!=10:
      s=s+b[i]^b[j]
      count+=1
    else:
      s=add(s,b[i]^b[j])
      count=0
s=add(0,s)
print(s)