8. Find all values of the parameter $a$ for which the equation

$$
(a-5+|x+1|)\left(a-x^{2}-2 x\right)=0
$$

has exactly two roots.

Solution: The given equation is equivalent to the system of equations $a-5+|x+1|=0$ and $a-x^{2}-2 x=0$. First, let's investigate the first equation.

Write it as $|x+1|=5-a$. It is clear that this equation has two roots when $a<5$.

Rewrite the second equation as $(x+1)^{2}=a+1$. It is clear that it has two roots when $a>-1$, has one root $x=-1$ when $a=-1$, and has no roots when $a<-1$.
2.I.8. Comment. The case of the roots of both equations in the system coinciding has not been considered in the given solution.

Correct answer: $(-\infty ;-1) \cup\{3\} \cup(5 ;+\infty)$.