To state the obvious: Such an $n$ must naturally have $p\equiv 1 \pmod{12}$ and $q\equiv 1\pmod{4}$.
Also, it seems The first condition is implied by the fact that, for each $q$ a prime such that$1 + q^2 + q^4 = 0\pmod{p}$, and so, since $q^2\vert (1 + p^2), 1 + q^2 + q^4\equiv \epsilon\pmod{p}$$p\neq 3$, where $p\equiv \epsilon\pmod{4}$$q^6\equiv 1\pmod{p}$ giving that (this holds with$3\vert p-1$, or without$p\equiv 1\pmod{3}$. The second is given by the fact that $p\equiv 1\pmod{4}$ condition$1+p^2\equiv 0\pmod{q}$ gives that $p^2\equiv -1\pmod{q}$, of course). In this caseand so $q\equiv 1\pmod{4}$, we have thatsince $\lceil \sqrt{p}\rceil\leq q< p$$\left(\frac{-1}{q}\right) = 1$.
EDIT: Typos galore!
EDIT 2: I undeleted.