For an odd prime p and integer a, the Legendre symbol (a|p) is defined to be −1 if x2 ≡ a mod p has no solution, 0 if p divides a, 1 if x2 ≡ a mod p has a solution and p does not divide a. Thus, the number of solutions mod p to x2 ≡ a is 1+(a|p). See quadratic reciprocity.