If ##p## is not in ##n## than ##(p,n)=1 ##.
Therefore for ##p^2\equiv 1mod(n)## to hold ##n=6a## since all ##p## other than 2 and 3 are of the form ##6b\pm 1##
Also all ##p\leq \sqrt{n}## must be in ##n## since otherwise ##p^2<n##.
so we need a ##p\sharp## such that ##p_{c+1}>\sqrt{p\sharp}##.
It's easy to see that this does not hold for ##p>5##.
Therefore the answer is 24.
[EDIT:-##p\sharp=p_1\times p_2 \times p_3\times...\times p_c##.]