def add(a,b):
  return (a ^ b) % 1000000007

####
N = int(input())
A =  list(map(int,input().split()))

sum = 0
for i in range(N):
  for j in range(i+1,N):
    sum += add(A[i], A[j])


ans = sum % (1000000007)
#出力

print(ans)