def ints():
  return [int(x) for x in input().split()]
def readi():
  return int(input())

N = readi()
A = ints()

s = 0
for i in range(N-1):
  for j in range(i+1, N):
    s += (A[i] ^ A[j])%(10**9+7)
print(s%(10**9+7))
