3. Given that $x$, $m$, and $n$ are positive integers, $m+n=5$, and $x^{2}+m$ and $\left|x^{2}-n\right|$ are both prime numbers. Then the number of possible values of $x$ is $\qquad$ .
3.2.

From the problem, $m$ can take the values $1,2,3,4$, and accordingly, $n$ can be $4,3,2,1$, with $m$ and $n$ being one odd and one even.
Thus, $x^{2}+m$ and $\left|x^{2}-n\right|$ are one odd and one even.
Since $x^{2}+m$ and $\left|x^{2}-n\right|$ are both prime numbers, it follows that $x^{2}+m=2$ or $\left|x^{2}-n\right|=2$.
Solving, we get $x=1, m=1$ or $x^{2}-n= \pm 2$.
When $x=1, m=1$, $n=4$.
$$
\left|x^{2}-n\right|=3 \text {. }
$$

So, $x=1$ satisfies the condition.
When $x^{2}-n=2$,
$$
x^{2}=n+2 \in\{3,4,5,6\} \text {. }
$$

Then $x=2$.
In this case, $n=2, m=3, x^{2}+m=7$.
So, $x=2$ satisfies the condition.
When $x^{2}-n=-2$,
$$
x^{2}=n-2 \in\{-1,0,1,2\} \text {. }
$$

Then $x=1$.
When $x=1$, $n=3, m=2, x^{2}+m=3$ is a prime number.
So, $x=1$ satisfies the condition.
Therefore, there are 2 possible values for $x$.