3. Let $n \geq 1$ be a natural number and $a>0$ a given real number. Find the number of solutions $\left(x_{1}, x_{2}, \ldots, x_{n}\right)$ to the equation

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

such that $x_{i} \in[0, a]$, for $i=1,2, \ldots, n$.