Question 27
Let $n \ge 2$ and $S = \{1, 2, \dots, n^2\}$. For any function $f : S \to S$ let $\text{Fix}(f) = \{x \in S \mid f(x) = x\}$. Find the possible values of the expression
$$
|\text{Fix}(f)| + |\text{Im}(f)| + \max_{k \in S} |f^{-1}(k)|
$$
as $f$ ranges over all functions $f : S \to S$.
$$
|\text{Fix}(f)| + |\text{Im}(f)| + \max_{k \in S} |f^{-1}(k)|
$$
as $f$ ranges over all functions $f : S \to S$.