For a=0 all n are solutions so suppose $a\neq 0$. First notice that $X^{2}$ always divides$f(X)=(X^{2}+a^{2})^{n}-X^{2n}-a^{2n}$ because $0$ is a root
of $(X^{2}+a^{2})^{n}-X^{2n}-a^{2n}$ and its derivative. Now if n is solution then all x such that $x^{2}+a^{2}=ax (1)$ are roots of $f$ and $f\^{\prime}$. From here we get that all such x satisfy $x^{n-1}=a^{n-1}$. From here we get $x=a\epsilon$ where $\epsilon$ is (n-1) root of unity. From
(1) we get $\epsilon^{2}-\epsilon+1=0(2)$ for now we have used only that x is a root of $f^\prime$ now since x is root of f we find$(\epsilon^{n})^{2}-(\epsilon^{n})+1=0$ so $\epsilon^{n}$ is a root of
(2). But this is true since $\epsilon^{n}=\epsilon$ so the only condition is for $\epsilon$ is to be (n-1) root of unity and from here we get that $n\equiv 1(mod 6)$ and these are the only solutions.