How many states are N steps far from the solution; recursive way