a = input()
inputList = input().split()


index = 0
sum = 0
for i in inputList:
  if index == len(inputList) - 1:
    break
  for j in inputList[index+1:]:
    sum += (int(i) ^ int(j))
  index += 1

print(sum % (10 **9 + 7))
