Solving equations with zero one or infinitely many solutions