How would I go about solving a problem like this:

Let B be the number of visits to state 2. Evaluate P (B = 1 | X0 = 3). I didn't provide the transition matrix because I just want to know the general way of solving such a problem.

Thanks for the help.