import sys

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