2. Given $f(x)=|1-2 x|, x \in[0,1]$, then the number of solutions to the equation
$$
f\left(f(f(x))=\frac{1}{2} x\right.
$$

is
2. Let $y=f(x), z=f(y), w=f(z)$, analyze the changes of $y, z, w$ when $x$ goes from 0 to 1:
$$
\begin{array}{l}
x: 0 \longrightarrow \frac{1}{2} \\
y: 1 \longrightarrow 0
\end{array}
$$
$$
\begin{array}{l}
z: 1 \xrightarrow{\frac{1}{2}} 0 \xrightarrow{\frac{1}{2}} 1 \xrightarrow{\frac{1}{2}} 0 \xrightarrow{\frac{1}{2}} 1, \\
w: 1 \rightarrow 0 \rightarrow 1 \rightarrow 0 \rightarrow 1 \rightarrow 0 \rightarrow 1 \rightarrow 0 \rightarrow 1,
\end{array}
$$

Since “ $\rightarrow$ ” indicates a linear change, and the change is within the non-negative real number range,

the graph of $w=f(f(f(x)))$ is as shown in the figure,

Clearly, the graph of $w=f(f(f(x)))$ intersects the line $w=\frac{x}{2}$ at 8 points, i.e., the number of solutions is 8.