import sys

n = int(sys.stdin.readline().strip())
a = [int(v) for v in sys.stdin.readline().strip().split()]
c = 0
for i in range(n-1):
  for j in range(i, n):
    c += a[i] ^ a[j]
print(c % (10 ** 9 + 7))