Solution (source code)

= Solution

The <Legendre symbol> equal to $1$ says that $a$ is a nonzero square modulo $p$. Choose one <root> $r\neq0$. Then $-r$ is another <root>, distinct because $p$ is odd. Any solution $x$ satisfies
$$
0=x^2-r^2=(x-r)(x+r)
$$
in the <field> $\mathbb F_p$, so $x=r$ or $x=-r$. Thus there are
$$
\boxed{2\text{ solutions}.}
$$