5. $a, b, c$ are distinct positive integers such that $\{a+b, b+c, c+a\}=\left\{n^{2},(n+1)^{2},(n+2)^{2}\right\}$, where $n$ is a positive integer, then the minimum value of $a^{2}+b^{2}+c^{2}$ is $\qquad$ .
Thus, $a^{2}+b^{2}+c^{2}=\frac{1}{4}\left[\left(n^{2}-2 n-3\right)^{2}+\left(n^{2}+2 n+3\right)^{2}+\left(n^{2}+6 n+5\right)^{2}\right]$
$=\frac{1}{4}\left[(n+1)^{2}(n-3)^{2}+(n+1)^{4}+4(n+1)^{2}+4+(n+1)^{2}(n+5)^{2}\right]$
$=\frac{1}{4}\left[3(n+1)^{4}+36(n+1)^{2}+4\right]$, obviously $n$ is odd and $a>0 \Rightarrow n>3$,
so the minimum value of $a^{2}+b^{2}+c^{2}$ is $\frac{1}{4}\left(3 \cdot 6^{4}+36 \cdot 6^{2}+4\right)=6^{4}+1=1297$, equality holds when $a=6, b=19, c=30$.