Question 170
For every natural number $n$, let $S(n)$ denote the sum of the digits of the decimal representation of $n$. We say that a natural number $n$ is pretty if $S(n)=S\left(n^{2}\right)$. Determine all possible values of $S(n)$ for pretty integers $n$.