Question 134
Let $n \geqslant 2$ be an integer and $X$ a set with $n$ elements. Show that the number of functions $f: X \rightarrow X$ such that $f \circ f$ is a constant function is equal to
$$
n \sum_{i=1}^{n-1}\binom{n-1}{i} i^{n-i-1}
$$
$$
n \sum_{i=1}^{n-1}\binom{n-1}{i} i^{n-i-1}
$$