count = int(input())
waru = 10**9 + 7
intlist = list(map(int,input().split()))
sum = 0
for i in range(len(intlist)):
  for j in range(i+1,len(intlist)):
    sum += intlist[i] ^ intlist[j]
print(sum%waru)