Function mapping challange 
For a given set $A=\{1, 2, 3, 4, \ldots, n\}$, find the number of non-constant
  mappings (associations ) $f$ from $A$ to $A$ such that $f(k) \leq f(k + 1)$
  and $f(k) = f(f(k + 1))$.

This is the text of the problem.
But I don't understand how can we have $f(k)$, when we are not given a function? 
Constant mapping is a mapping $f$ such that for some C, $f(k)$=C for all k. Thanks to @ferson2020 for explanation
 A: We can describe the allowable sequences as follows. For some constant $k$ and a value of $r<n$ we have $f(x)=k$ for $1 \le x \le r$, while $f(x)>k$ for $x>r.$ (We need $r<n$ here to avoid a constant sequence.) So far this satisfies $f(x)=f(f(x+1))$ since it is constant. Now consider what happens if we define $f(r+1)=y.$ Then from 
$$k=f(r)=f(f(r+1))=f(y)$$
we see that $y \le r$ (only the first $r$ integers of $\{1,...,n\}$ map to $k$), and at the same time we have $y>k$ since $r$ is the greatest integer mapping to $k$ and $y=f(r+1).$ We thus have, for choices of the value $y$, the only restriction
$$k+1 \le y \le r.$$
So there are $r-k$ choices for $y$. We also note that we have $k<r$ by combining the above $k<y$ and $y \le r$.
Once the map is defined on $[1,r+1]$ by mapping $[1,r]$ to $k$ and $r+1$ to one of the choices for $y$, the values of $f$ for $r+2,...,n$ are all determined by use of $f(x)=f(f(x+1))$ and in this range $f(x)=x-1$ is forced.
So we need to add, for all choices of $k,r$ with $1 \le k<r<n$, the number of choices $r-k$ for the value of $y$.
Then the number of maps is the double sum
$$\sum_{r=2}^{n-1} \sum_{k=1}^{r-1}(r-k).$$
The inner sum here is $\binom{n}{2},$ and summing that gives the final count as
$\binom{n}{3}$
