How many positive integers of at most $n$ digits are there whose square ends in the same $n$ digits (possibly with some leading zeros)?
I. solution. To simplify the discussion, we first solve the problem for non-negative integers (thus allowing 0).

We prove by complete induction that for every positive integer $n$, there exist exactly four non-negative integers whose squares end in the same $n$ digits, and among these four numbers, two are 0 and 1, while the other two end in 5 and 6, respectively.

For the case $n=1$, by checking all nine single-digit numbers, we can see that indeed the numbers 1, 5, and 6 are suitable.

Assume that our statement is true for $n=k$; from this, we will prove it for $n=k+1$.

We seek the numbers in the form $x=10^{k} \cdot a+b$, where $0 \leq a \leq 9$ is the first digit, and $0 \leq b<10^{k}$ is the number formed by the last $k$ digits. It must be true that the last $k+1$ digits of $x$ and $x^{2}$ are the same, i.e.,

$$
10^{k+1} \mid x^{2}-x=10^{k+1} 10^{k-1} a^{2}+10^{k} \cdot(2 b-1) a+\left(b^{2}-b\right)
$$

Among the three terms on the right side, the first is definitely divisible by $10^{k+1}$, and the second by $10^{k}$. Therefore, the last term, $\left(b^{2}-b\right)$, must be divisible by $10^{k}$. By the induction hypothesis, there exist four such possible $b$ values.

For the right side to be divisible not only by $10^{k}$ but also by $10^{k+1}$, it is necessary and sufficient that $(2 b-1) a+\frac{b^{2}-b}{10^{k}}$ is divisible by 10. Since $2 b-1$ is relatively prime to 10 in all four cases, exactly one suitable $a$ can be found for each of them. Thus, each of the four possible $b$ values can be uniquely extended to a number with at most $(k+1)$ digits. It is also clear that for $b=0$ and $b=1$, the new digit is 0, but in the other cases, the last digit is the same as the last digit of $b$.

Therefore, for any $n$, there are three suitable positive integers.

II. solution. Let $x$ be a positive integer with at most $n$ digits (i.e., $0 \leq x<10^{n}$), such that the last $n$ digits of $x$ and $x^{2}$ are the same, i.e., $10^{n}=2^{n} \cdot 5^{n} \mid x^{2}-x=x(x-1)$. Since $x$ and $x-1$ are relatively prime, this is true if and only if one of $x$ and $x-1$ is divisible by $2^{n}$, and one (possibly the same) is divisible by $5^{n}$. This results in 4 cases.

1. case: $2^{n} \mid x$ and $5^{n} \mid x$. Then $10^{n} \mid x$, which contradicts the condition on $x$. Therefore, there is no such $x$.
2. case: $2^{n} \mid x$ and $5^{n} \mid x-1$. Then $10^{n} \mid x-1$, which is true for $x=1$. This case thus provides one solution, the number 1.
3. case: $2^{n} \mid x-1$ and $5^{n} \mid x$. Then $x=k \cdot 5^{n}$ for some integer $0<k<2^{n}$. Since $2^{n}$ and $5^{n}$ are relatively prime, the numbers $0 \cdot 5^{n}, 1 \cdot 5^{n}, 2 \cdot 5^{n}, \ldots,\left(2^{n}-1\right) \cdot 5^{n}$ form a complete residue system modulo $2^{n}$, hence exactly one of them gives a remainder of 1 when divided by $2^{n}$. This cannot be 0. This case also provides one possible $x$.
4. case: $2^{n} \mid x$ and $5^{n} \mid x-1$. The examination of this case is the same as in the 3rd case, only the numbers $2^{n}$ and $5^{n}$ need to be swapped.

In cases 2, 3, and 4, we found one solution each; thus, there are three positive integers with at most $n$ digits whose squares end in the same $n$ digits.

Remarks. 1. For the two non-trivial solutions, Tamás Terpai provided explicit formulas: one number is the remainder of $5^{2^{n}}$ when divided by $10^{n}$, and the other number is the remainder of $10^{n}-5^{2^{n}}+1$ when divided by $10^{n}$. The reason for this is that

$$
\left(5^{2^{n}}\right)^{2}-5^{2^{n}}=5^{2^{n}}\left(5^{2^{n-1}}+1\right)\left(5^{2^{n-2}}+1\right) \ldots\left(5^{2^{0}}+1\right)\left(5^{2^{0}}-1\right)
$$

The $5^{2^{n}}$ on the left side and the $n+1$ factors ensure that this number is divisible by $10^{n}$. (The proof for the other number is similar.)

2. Several contestants did not consider the case of 0. They received 4 points.