5. The function defined on the domain $R$
$$
f(x)=|\lg | x-2||-1 \text{. }
$$

If $b<0$, then the equation concerning $x$
$$
f^{2}(x)+b f(x)=0
$$

has $\qquad$ distinct real roots.
5. 8 .

From the problem, we know that the graph of $y=\lg x$ is first symmetrical about the $y$-axis, then the part below the $x$-axis is flipped up, followed by a rightward shift of 2 units and a downward shift of 1 unit to form the graph of $f(x)$. The zeros of $g(x)=f^{2}(x)+b f(x)$ are the roots of the equation. It is easy to see that $g(x)$ has 8 zeros.