N = int(input())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

def xor(a, b):
  return a^b

ans = 0
for i in range(N-1):
  for j in range(i + 1, N):
    ans += xor(A[i] , A[j])
    ans = ans % MOD

print(ans%MOD)
