def xor(x,y):
  return x^y

mod = pow(10,9)+7
n = int(input())
A = list(map(int, input().split()))
ans = 0

for i in range(n):
  for j in range(i+1, n):
    a = xor(A[i],A[j])
    ans += a%mod
print(ans%mod)