N = input()
a = list(map(int, input().split()))
i = 0
sum = 0
while i < len(a)-1:
  for j in range(i+1, len(a)):
    #print(i, j)
    sum += a[i]^a[j]
    while sum >= 1000000007:
      sum -= 1000000007
  i += 1
print(sum)