Here's a solution which solves the problem. 100% accuracy and minimal visits to the tower.

Maiden one: If the right lever is in the up position, lower it. Otherwise let it stay and move the left lever. Next time, if the left lever is in the same position, move the left lever. Repeat until left lever is in a different position from the last time. Once the left lever has shifted, maiden one knows someone else has been to the chamber. Maiden one now moves the right lever to the up position. Next time, if the right lever is in the up position, no maiden who has seen the right switch down has been to the chamber for the first time. Move the right lever down. If the right lever is down, at least one other maiden has been to the chamber for the first time. Move the left lever and repeat the previous steps of checking for a change in the left lever's position. Once the left lever has shifted, at least one other maiden has been to the chamber. (Herein would lie a bug, if the first maiden didn't lower the right lever whenever she sees it. If the same two maidens repeatedly visit the chamber in the beginning, we have a stalemate. The other maidens would never see the right lever in the down position.) Shift the right lever to the up position. Wait for it to come down. Once it's come down, a second maiden has been to the chamber. Repeat. Once the right lever has been shifted down 22 times, all maidens have been to the chamber.

Maidens 2-23: If the right lever is up, move the left lever. If the right lever is down, next time we come to the chamber, and the right lever is up, shift the right lever down. If one comes to the chamber after having shifted the right lever down previously, keep shifting the left lever. The rule is that maidens 2 though 23 all shift the right lever only once, and only after they have seen the right lever down. Only the first maiden shifts the right lever up, so once this has occurred, they can be sure that the first maiden has been to the chamber after their last visit.

The problem we have is that the other maidens must be assured that maiden one has been to the chamber. This is done by seeing the right lever in the lower position, and then in the up position. Since only maiden one shifts the right lever up, if it's been down and is now up, maiden one has been to the chamber.

The problem arises when two maidens, one of whom is maiden one, visit the chamber repeatedly. Maiden one shifts the right lever down, waits for maiden two to visit, and then shifts the right lever up. Maiden two has seen the right lever down, and shifts it down from the up position. Maiden one now waits for the left lever to be in a different position from the last time. This happens the next time maiden two visits the chamber. Maiden one now thinks someone else has been to the chamber and shifts the right lever up. Next, maiden three comes in and seeing that the lever is up, shifts the left lever (only maiden two has seen the right lever down). No matter how many times anyone comes to the chamber, none of the maidens shifts the right lever down, since they never see the lever down.

The solution is to have maiden one shift the right lever down if she sees it still in the up position. Now the next maiden will see it is down. If the right lever is still in the up position when maiden one comes in, she knows she was herself the one to shift it up, and that there has been no maiden who has both seen the right lever down and has visited the chamber for the first time.

I wrote a java program which demostrates the actions of the maidens in java. It is probably easier to understand than the above explanation. At least I wrote it with more care.

It's available at http://www.plug.fi/23maidens/Witch.java.txt