Let X be a set such that $\displaystyle |X|= n$, where n is a positive integer. Call a function $\displaystyle f: X -> X$flatif some iterate of it is constant.

For example, if $\displaystyle f^{(2)}(x)$ denotes $\displaystyle f(f(x))$, and $\displaystyle f^{(3)}(x)$ denotes $\displaystyle f(f(f(x)))$, a function isflatif there exists a positive integer k such that $\displaystyle f^{(k)}(x)$ is a constant function on X.

In terms of n, how many flat functions are there on X?