11. C5 (FIN) Find all finite sequences $\left(x_{0}, x_{1}, \ldots, x_{n}\right)$ such that for every $j, 0 \leq j \leq n, x_{j}$ equals the number of times $j$ appears in the sequence.
11. Let $\left(x_{0}, x_{1}, \ldots, x_{n}\right)$ be any such sequence: its terms are clearly nonnegative integers. Also, $x_{0}=0$ yields a contradiction, so $x_{0}>0$. Let $m$ be the number of positive terms among $x_{1}, \ldots, x_{n}$. Since $x_{i}$ counts the terms equal to $i$, the sum $x_{1}+\cdots+x_{n}$ counts the total number of positive terms in the sequence, which is known to be $m+1$. Therefore among $x_{1}, \ldots, x_{n}$ exactly $m-1$ terms are equal to 1, one is equal to 2, and the others are 0. Only $x_{0}$ can exceed 2, and consequently at most one of $x_{3}, x_{4}, \ldots$ can be positive. It follows that $m \leq 3$. (i) $m=1$: Then $x_{2}=2$ (since $x_{1}=2$ is impossible), so $x_{0}=2$. The resulting sequence is $(2,0,2,0)$. (ii) $m=2$: Either $x_{1}=2$ or $x_{2}=2$. These cases yield $(1,2,1,0)$ and $(2,1,2,0,0)$ respectively. (iii) $m=3$: This means that $x_{k}>0$ for some $k>2$. Hence $x_{0}=k$ and $x_{k}=1$. Further, $x_{1}=1$ is impossible, so $x_{1}=2$ and $x_{2}=1$; there are no more positive terms in the sequence. The resulting sequence is $(p, 2,1, \underbrace{0, \ldots, 0}_{p-3}, 1,0,0,0)$.