The answer explains this. The number should be (p - 1) x 2 where p is the number of prisoners. (23-1) = 22 * 2 = 44
If switch A starts out in the ON position it would equal one 'fake' prisoner. If the counter just counts one extra (which equals p - 1 (himself) + 1 (fake prisoner) = p) it should be enough, no?