Find all the possible values of the sum of the digits of all the perfect squares.

[Commented by djimenez]
[b]Comment: [/b]I would rewrite it as follows: 
Let $f: \mathbb{N}\rightarrow \mathbb{N}$ such that $f(n)$ is the sum of all the digits  of the number $n^2$. Find the image of $f$ (where, by image it is understood the set of all $x$ such that exists an $n$ with $f(n)=x$).
1. **Understanding the Problem:**
   We need to find the set of all possible values of the sum of the digits of perfect squares. Let \( f(n) \) be the function that maps a natural number \( n \) to the sum of the digits of \( n^2 \). We are interested in the image of \( f \), i.e., the set of all possible values \( f(n) \) can take.

2. **Using Known Results:**
   We use two known results to find patterns in the sum of the digits of perfect squares.

3. **First Result:**
   Consider the number \( 11\cdots 1122\cdots 225 \) (with \( n \) times the digit 1 followed by \( n+1 \) times the digit 2 and ending with the digit 5). This number is a perfect square. The sum of its digits is:
   \[
   n \cdot 1 + (n+1) \cdot 2 + 5 = n + 2(n+1) + 5 = 3n + 7
   \]
   Therefore, the sum of the digits of this perfect square is \( 3n + 7 \).

4. **Second Result:**
   Consider the number \( (10^n - 1)^2 \). Expanding this, we get:
   \[
   (10^n - 1)^2 = 10^{2n} - 2 \cdot 10^n + 1 = 100\cdots 000 - 20\cdots 000 + 1 = 99\cdots 9800\cdots 001
   \]
   (with \( n-1 \) times the digit 9, followed by \( n-1 \) times the digit 0, and ending with the digits 8 and 1). The sum of its digits is:
   \[
   9(n-1) + 8 + 1 = 9n
   \]
   Therefore, the sum of the digits of this perfect square is \( 9n \).

5. **Combining Results:**
   From the first result, we have sums of the form \( 3n + 7 \).
   From the second result, we have sums of the form \( 9n \).

6. **Modulo 9 Analysis:**
   We observe that:
   \[
   3n + 7 \equiv 0, 1, 4, 7 \pmod{9}
   \]
   and
   \[
   9n \equiv 0 \pmod{9}
   \]
   Therefore, the possible values of the sum of the digits of perfect squares modulo 9 are \( 0, 1, 4, 7 \).

7. **Conclusion:**
   The possible values of the sum of the digits of perfect squares are those that are congruent to \( 0, 1, 4, \) or \( 7 \) modulo 9.

The final answer is \( \boxed{ \{0, 1, 4, 7 \} \pmod{9} } \)