8. Place $n$ distinct balls into $n$ distinct boxes, assuming each ball has an equal probability of landing in any box. Then, the mathematical expectation of the number of empty boxes is $\qquad$

Place the above text in English, preserving the original text's line breaks and format, and output the translation result directly.
8. $\frac{(n-1)^{n}}{n^{n-1}}$.

Define random variables $x_{i}(i=1,2, \cdots, n)$ as follows: when the $i$-th box contains a ball, $x_{i}=0$; when the $i$-th box is empty, $x_{i}=1$. Let $\xi=\sum_{i=1}^{n} x_{i}$, then $\xi$ represents the number of empty boxes.

Since the probability of each ball being placed in the $i$-th box is $\frac{1}{n}$, the probability of not being placed in that box is $\frac{n-1}{n}$. Because the placement of each ball into the $i$-th box is independent, the probability that none of the $n$ balls are placed in the $i$-th box is $\left(\frac{n-1}{n}\right)^{n}$, and the probability that at least one ball is placed in the $i$-th box is $1-\left(\frac{n-1}{n}\right)^{n}$. Therefore, the distribution of $x_{i}$ is as shown in Table 1.
Table 1
\begin{tabular}{c|c|c}
\hline$x_{i}$ & 0 & 1 \\
\hline$P$ & $1-\left(\frac{n-1}{n}\right)^{n}$ & $\left(\frac{n-1}{n}\right)^{n}$ \\
\hline
\end{tabular}

Thus,
$$
E\left(x_{i}\right)=0 \times\left(1-\left(\frac{n-1}{n}\right)^{n}\right)+1 \times\left(\frac{n-1}{n}\right)^{n}=\left(\frac{n-1}{n}\right)^{n},
$$

Therefore,
$$
E(\xi)=\sum_{i=1}^{n} E\left(x_{i}\right)=n \cdot\left(\frac{n-1}{n}\right)^{n}=\frac{(n-1)^{n}}{n^{n-1}} .
$$