import copy
n=int(input())
s=list(map(int,input().split()))
mod=1000000007
goukei=0
for i in s:
  sa=copy.deepcopy(s)
  del sa[:s.index(i)]
  for j in sa:
    goukei+=(i^j)%mod
kotae=goukei%mod
print(kotae)