This is hurting my brain. I keep thinking of things and then realising they wouldn't work....

Everybody who goes to the room, flips the A switch the first time he goes, and the B switch ever after, all the while noting the position of both switches on entering the room? until the switches have changed position enough times?

Let's see:

Say I go into the room for what is my first time. I know the plan is that I am to switch A this time, and B any subsequent time I visit the room. When I arrive, A is up and B is down. I switch A down.

Some time elapses. I return to the room. I notice that A is up again and B is also up. From this I deduce that someone new has visited the room, and someone who has returned at least once.

I reckon each prisoner has to adhere to this method until he's visited the room a minimum of 23 times - possibly more....Say the next time I return to the room, A is still up, and B has also returned to the up position (because I put it down the time I visited before, right?). That means either no one new has visited, or two new people have visited; but it certainly means that someone has returned in the interim.

By my 23rd visit, if switch A appears never to have moved - according to what I see, and only what I see - then it is possible that everyone has visited the room. However, if....

Bah, humbug. I can't do it. What on earth plan could they devise? They can't decide that only the last guy to go can switch the B switch and all the rest will use the A - how can they know who's going to be the last guy?!

But given that there are 23 of them, methinks it must be a numbers game....Perhaps it could be something pivotal: 11 of them will only use the A switch, 11 will only use the B switch, but the 23rd person may use either....Nah, how would that work? he still wouldn't know, whichever switch he decided to use, how many had gone before him on either switch, or how many times each had gone.

I'm going to stop thinking a-write here, and go to bed so I can lose sleep over this.