Suppose that $m$ is odd. Show that if $\gcd(a,p) = 1$ then the number of solutions of the congruence $x^2 \equiv a \mod m$ is $\displaystyle \prod_{p \mid m} \left(1+ \left(\dfrac{a}{p} \right) \right).$ Show that this holds for all integers $a$ if $m$ is an odd square-free number.
Not really sure how to approach this problem. There are $a^{\frac{p-1}{2}}$ quadratic residues mod $p$ and this is congruent to $\left(\dfrac{a}{p} \right).$ But this is the case where $p$ is prime and not an arbitrary odd integer. Additionally, since $\gcd(a,p) = 1,$ we have $\left(\dfrac{a^2}{p} \right) = 1,$ $\left(\dfrac{a^2b}{p} \right) = \left(\dfrac{b}{p} \right).$ How do we prove the above proposition?