import numpy as np
n = int(input())
l = input()
l = list(map(int, l.split()))
l = np.array(l)

sum_xor = 0
for i in range(n):
  for j in range(i+1, n):
    sum_xor += l[i]^l[j]
    # sum_xor %= 10**9+7

print(sum_xor % (10**9+7))