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