For all prime numbers where , define to be the set of all positive integers such that with and as quadratic residues modulo . For example, , because are quadratic residues modulo 11
It can be proven that is non-empty for all . Let be the smallest element of . Find the maximum value of among all .
If this maximum doesn't exist, enter 0 as your answer.