Let $A = \{1,2,\ldots,2011\}$.  Find the number of functions $f$ from $A$ to $A$ that satisfy $f(n) \le n$ for all $n$ in $A$ and attain exactly $2010$ distinct values.

Let's think step by step and output the final answer within \boxed{}.
user