n = int(input())
a = list(map(int, input().split()))
l = []
x = 0
y = 1
time = 0
for i in range(n):
  n -= 1
  time += n
for i in range(time):
  l.append(a[x] ^ a[y])
  y += 1
  if y == len(a):
    x += 1
    y = x+1
total = sum(l)
print(total % (10**9 + 7))