Recall that if $h$ is a function from $X$ to $Y$ and $g$ is a function from $Y$ to $Z$ then, $g \circ h$ is the function from $X$ to $Z$ such that $(g \circ h)(x)=g(h(x))$, for all $x \in X$.
Let $S$ be the set of all functions $f$ from $\{1, 2, 3, 4, 5, 6\}$ to $\{1, 2, 3, 4, 5, 6\}$ such that $f \circ f=f$.
- Compute the number of functions $f \in S$ whose range has three elements.
- What is the cardinality of $S$?