What are all possible values of $ x \equiv a^\frac{p-1}{2} \pmod p$? Suppose p is an odd prime and a $\in$ $\mathbb{Z}$ such that  $ a \not\equiv 0 \pmod p$. What are all the values of $ x \equiv a^\frac{p-1}{2} \pmod p$ ?
This is what I got so far:
$ x^2 \equiv a^{p-1} \pmod p$
By Fermat's Little Theorem,
$ x^2 \equiv 1 \pmod p$
$ x^2 - 1 \equiv 0 \pmod p$
$ (x - 1)(x+1) \equiv 0 \pmod p$
So $\;p\mid(x-1)$ or $p\mid(x+1)$. 

Do you know about quadratic residues ?
The values of $x$ are $1$ and $-1$.
$\frac{p-1}{2}$ values of $1$ and also $\frac{p-1}{2}$ values of $-1$.
