5. Let $n \in \mathbf{N}_{+}$, and
$$
n^{4}+2 n^{3}+5 n^{2}+12 n+5
$$

be a perfect square. Then $n=$ $\qquad$
5.1 or 2 .
$$
\begin{array}{l}
\text { Given }\left(n^{2}+n+2\right)^{2} \\
<n^{4}+2 n^{3}+5 n^{2}+12 n+5 \\
<\left(n^{2}+n+4\right)^{2} \\
\Rightarrow n^{4}+2 n^{3}+5 n^{2}+12 n+5=\left(n^{2}+n+3\right)^{2} \\
\Rightarrow n=1 \text { or } 2 \text {. }
\end{array}
$$