12. Given that the equation $x^{3}+3 x^{2}-x+a$ $=0$ has three real roots that form an arithmetic sequence. Then the real number $a=$ $\qquad$
12. -3 .

Let these three roots be $b-d$, $b$, and $b+d$. Then
$$
\begin{array}{l}
x^{3}+3 x^{2}-x+a \\
=(x-b+d)(x-b)(x-b-d),
\end{array}
$$

i.e., $3 x^{2}-x+a$
$$
=-3 b x^{2}+\left(3 b^{2}-d^{2}\right) x-b^{3}+b d^{2} \text {. }
$$

Comparing coefficients, we get
$$
-3 b=3,3 b^{2}-d^{2}=-1,-b^{3}+b d^{2}=a \text {. }
$$

Thus, $a=-3$.