How prove this diophantine equation $x^2-y^2\equiv a\pmod p$ have only $p-1$roots Question:

let $a\neq 0$.and $p$ is prime numbers.
show that the number of ordered two-tuples $(x,y)$such  this following diophantine equation
$$x^2-y^2\equiv a\pmod p$$
at most $p-1$

Maybe we can use Fermat’s little theorem: if $(a,p)=1$, then we have
$$a^{p-1}\equiv 1\pmod p$$
but I can't use it,Thank you
 A: Extended Hint: Assume that $p>2$. Show that to any pair $a_1,a_2\in\{1,2,\ldots,p-1\}$ such that $a_1a_2\equiv a\pmod p$ there is a unique pair $(x,y)$ of residue classes such that
$$
\left\{\begin{aligned}x+y\ &\equiv a_1\pmod p,\\x-y\ &\equiv a_2\pmod p.\end{aligned}\right.
$$
Because we can choose $a_1$ arbitrarily, and to a fixed $a_1$ there is a unique $a_2$ such that $a_1a_2\equiv a$, the number of pairs $(a_1,a_2)$ is exactly $p-1$.
The assumption $p>2$ is needed in proving the uniqueness of the solution $(x,y)$ of that pair of congruences. If you are familiar with tools from linear algebra (applied to the field $\Bbb{F}_p=\Bbb{Z}/p\Bbb{Z}$), then this is trivial because the determinant of the coefficient matrix is $-2$.
Leaving it to you to check what surprises lie ahead, when $p=2$. There are so few choices for $a$ in that case so a brute force enumeration will do it (unless you want to use the so called Freshman's dream).
A: It's a simple application of quadratic residue theory.
(I omit$\mod p $ for convenience' sake)
If you choose any $y$ (notice that $\pm y$ have same solution $x$), then the equation $x^2 \equiv a+y^2$ has two solutions if $\left(\frac{a+y^2}{p}\right)=1$, and there is no solution if $\left(\frac{a+y^2}{p}\right)=-1$. 
And there are exactly $\frac{p-1}{2}$ residues $k\not\equiv 0\mod p$  s.t $\left(\frac{k}{p}\right)=1$.
Hence there are at most $2\times \frac{p-1}{2}=p-1$ solutions $(x,y)$ s.t $a+y^2 \not\equiv 0$.
Moreover, if there exists $y$ s.t $a+y^2\equiv 0$, then there is a quadratic residue which cannot be represented by the form $a+y^2$, because $\left\{y^2 \mod p: y\not \equiv 0\right\}$ is the whole set of quadratic residues.
Thus, in this case, there are at most $2+2\times (\frac{p-1}{2}-1)=p-1$ solutions, like above.
