Let $a,n$ be relatively prime integers. If there exists an integer $x$ that satisfies $$x^2 \equiv a \pmod{n}$$ then $a$ is said to be a quadratic residue of $n$ . Otherwise, $a$ is called a quadratic nonresidue of $n$ .