5. Given the function $f(x)=\left\{\begin{array}{l}2^{-x}-1, x \leqslant 0, \\ f(x-1), x>0,\end{array}\right.$ If the equation $f(x)=x+a$ has exactly two distinct real roots, then the range of the real number $a$ is $\qquad$ .
As shown in the figure, when $a \geqslant 1$, the graph of $y=f(x)$ intersects the line $y=x+a$ at only one point. When $a<1$, the graph of $y=f(x)$ always intersects the line $y=x+a$ at two points. Therefore, the range of the real number $a$ is $(-\infty, 1)$