4. Find all non-negative real solutions $\left(x_{1}, x_{2}, \ldots, x_{n}\right)$ of the system of equations

$$
x_{i+1}=x_{i}^{2}-\left(x_{i-1}-1\right)^{2}, \quad i=1,2, \ldots, n
$$

(Indices are taken cyclically modulo $n$.)
4. By summing all $n$ equations, we obtain

$$
\sum_{i=1}^{n} x_{i}=\sum_{i=1}^{n} x_{i}^{2}-\left(\sum_{i=1}^{n} x_{i}^{2}-2 \sum_{i=1}^{n} x_{i}+n\right)
$$

which simplifies to $\sum_{i=1}^{n} x_{i}=n$. Without loss of generality, assume that $x_{1}$ is the minimum among $x_{1}, x_{2}, \ldots, x_{n}$. Then we have $0 \leqslant x_{1} \leqslant 1$. However, the first equation gives $x_{2}=x_{1}^{2}-\left(x_{n}-1\right)^{2} \leqslant x_{1}^{2} \leqslant x_{1}$, so due to the minimality of $x_{1}$, it must be that $x_{2}=x_{1}=x_{1}^{2}$ and $x_{n}=1$. From this, it follows that $x_{1}=0$ or $x_{1}=1$. In the first case, we similarly obtain $x_{3}=x_{2}=0, x_{4}=x_{3}=0$, etc., i.e., $x_{2}=x_{3}=\cdots=x_{n}=0$, which is not a solution. The only remaining case is $x_{1}=1$, and from this, we again similarly obtain $x_{1}=x_{2}=\cdots=x_{n}=1$, so this is the only solution.