15. Form an $n$-digit number using the digits $1,2,3$, such that each of $1,2,3$ appears at least once. Find the number of such $n$-digit numbers.
15. Let $A_{1}, A_{2}, A_{3}$ be the sets of $n$-digit numbers that do not contain the digits $1, 2, 3$ respectively. $\left|A_{i}\right|=2^{n}, i=1,2,3,\left|A_{i} \cap A_{j}\right|=1$, $1 \leqslant i<j \leqslant 3,\left|A_{1} \cap A_{2} \cap A_{3}\right|=0$, and the digits $1,2,3$ can form $3^{n}$ $n$-digit numbers. The set of $n$-digit numbers that meet the requirements is $\overline{A_{1}} \cap \overline{A_{2}} \cap \overline{A_{3}}$. By the principle of inclusion-exclusion, $\left|\overline{A_{1}} \cap \overline{A_{2}} \cap \overline{A_{3}}\right|=3^{n}-\left(\left|A_{1}\right|+\left|A_{2}\right|+\left|A_{3}\right|\right)+\left(\left|A_{1} \cap A_{2}\right|+\right.$ $\left.\left|A_{1} \cap A_{3}\right|+\left|A_{2} \cap A_{3}\right|\right)-\left|A_{1} \cap A_{2} \cap A_{3}\right|=3^{n}-3 \times 2^{n}+3$