real analysis – Your comments about the roots of $f(x)=f^{-1}(x),~ f:R rightarrow R$ are welcome

I find that roots of
$$f(x)=f^{-1}(x), f:Rrightarrow R~~~~~~~(1)$$
are the same as those of $f(x)=x$ and $f^{-1}(x)=x$ if $f(x)$
an increasing function. If $f(x)$ is decreasing then roots of (1) are the same as
$f(x)=-x$ and $f^{-1}(x)=-x.$ Two functions: $f(x)= x^3$ and $f(x)=-x^3$ are examples.

I would like to know if it is necessarily true, are there exceptions? What could be a generalization of roots of (1) in the light of these two cases.