Solution (source code)

= Solution

The <Legendre symbol> being one means $a$ is nonzero and a square modulo $p$. Take one root $r\ne0$. Factoring $x^2-r^2=(x-r)(x+r)$ in the <field> shows that any root is $r$ or $-r$. Since $p$ is odd these are distinct. Thus there are exactly $\boxed{2}$ solutions.