N = gets.to_i
A = gets.chomp.split.map(&:to_i)
result = 0
w =  10 ** 9 + 7 
for i in 0..N-2
  for j in (i+1)..N-1
    if A[i] == A[j]
      next
    end
    result += A[i]^A[j]
    result = result % w
  end
end
p result 