For each positive integer $n$, let $S(n)$ denote the sum of the digits of $n.$ Find the number of values of $n$ such that $n + S(n) + S(S(n)) = 2007.$

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