5. For a given positive integer $n$, the number of integer points in the closed region (including the boundary) formed by the line $y=$ $n^{2}$ and the parabola $y=x^{2}$ is $\qquad$
5. $\frac{1}{3}(2 n+1)\left(2 n^{2}-n+3\right)$.

As shown in Figure 5, the line $y=n^{2}$ intersects the parabola $y=x^{2}$ at points $A\left(n, n^{2}\right)$ and $B\left(-n, n^{2}\right)$. Let the segment on the line $x=k$ within the region be $C D$, with endpoints $C\left(k, n^{2}\right)$ and $D\left(k, k^{2}\right)$. The number of integer points on segment $C D$ is $n^{2}-k^{2}+1(k \in 1-n, \cdots,-1, 0,1,2, \cdots, n)$. Therefore, the number of integer points within the region is
$$
\begin{array}{l}
\sum_{k=-n}^{n}\left(n^{2}-k^{2}+1\right)=(2 n+1)\left(n^{2}+1\right)-2 \sum_{k=1}^{n} k^{2} \\
=\frac{1}{3}(2 n+1)\left(2 n^{2}-n+3\right)
\end{array}
$$