CountRoots
CountRoots[f, x] gives the number of real roots of the univariate function f in x.
CountRoots[f, {x, a, b}] gives the number of roots between a and b.
Examples
Count roots of a polynomial:
CountRoots[x^3 - x, x]
(* 3 *)Please visit the official Wolfram Language Reference for more details.