Let the first term of a series be $\mathrm{T}_1=6$ and its $\mathrm{r}^{\text {th }}$ term $T_r=3 T_{r-1}+6^r, r=2,3, \ldots, n$. If the sum of the first $n$ terms of this series is $\frac{1}{5}\left(n^2-12 n+39\right)\left(4.6^n-5.3^n+1\right)$. Then $n$ is equal to $\_\_\_\_$ .