Distribution of different objects into different boxes We want to put n different objects into n different boxes. In how many ways can we do this if we want that exactly two boxes remain empty?

The number of ways to choose the two boxes that are to remain empty is a combination:
$$\binom{n}{2} = \frac{n(n-1)}{2}$$
As for the remaining boxes, there can either be $1$ box with $3$ objects and $n-3$ boxes with $1$ object each, or $2$ boxes with $2$ objects each and $n-4$ boxes with $1$ object each.

Case 1: One box has three objects.
The number of ways to choose this special box is $n-2$. The number of ways to choose the three objects that go in this one box is $$\binom{n}{3}$$. Then, the number of ways to permute the remaining $n-3$ objects in the $n-3$ boxes is simply $(n-3)!$. Thus, the total number of ways to place the objects in this case is $$\binom{n}{2} \cdot (n-2) \cdot \binom{n}{3} \cdot (n-3)!$$

Case 2: Two boxes have two objects.
The number of ways to choose the two special boxes is $$\binom{n-2}{2}$$ Once these boxes are chosen, the number of ways to choose the objects that go in the first of these is $$\binom{n}{2}$$ After choosing these, the number of ways to choose the objects that go in the second box with two things in it, since there are $n-2$ objects left to choose from, is $$\binom{n-2}{2}$$ Finally, the number of ways to permute the remaining $n-4$ objects in the remaining $n-4$ boxes is $(n-4)!$. This gives the number of placements in this case as $$ \binom{n-2}{2} \cdot \binom{n}{2} \cdot \binom{n-2}{2} \cdot (n-4)!$$

The final answer is the sum of the answers in cases 1 and 2, which is
$$\boxed{\binom{n}{2} \cdot (n-2) \cdot \binom{n}{3} \cdot (n-3)! + \binom{n-2}{2} \cdot \binom{n}{2} \cdot \binom{n-2}{2} \cdot (n-4)!}$$

Edit: I noticed that the final answer, as I wrote it, could be simplified quite nicely. First, we can expand the binomial coefficients and combine $n-2$ and $(n-3)!$:
$$\frac{n(n-1)}{2} \cdot (n-2)! \cdot \frac{n(n-1)(n-2)}{6} + \frac{(n-2)(n-3)}{2} \cdot \frac{n(n-1)}{2} \cdot \frac{(n-2)(n-3)}{2} \cdot (n-4)!$$
Then, we find that both terms have $n!$ in them:
$$\frac{n!}{2}\binom{n}{3} + \frac{n!}{4}\binom{n-2}{2}$$
$$\frac{n!}{4}\cdot\frac{n(n-2)(n-3)}{3} + \frac{n!}{4}\cdot\frac{(n-2)(n-3)}{2}$$
This ends up as the relatively concise expression
$$\frac{n!(n-2)(n-3)}{4}\left(\frac{n}{3}+\frac{1}{2}\right)$$
