When you flip configurations, an extra boy is shifted into the sector, forming the boy pair, so you can now count three boys in that sector instead of two. What is shifted out is just a fraction of a leg, so there is a net gain of one boy.
The remainder of the circle is constructed so that there appears is no net change in the number of boys there. The fraction of a leg which is shifted in replaces a fraction of a leg, and the boy which is shifted out is replaced by a boy.
But note that this is a paradox: you can't shift a leg into one end of a register, such that a person is shifted out of the other end, and yet have the person count in that register remain the same! That's like shifting a 0 into a bit register, such that 1 is shifted out the other end, yet the parity remains the same.
The subterfuge is that in configuration B, there is a Siamese twin body with two heads (A + 2 clockwise). The casual observer glosses over this, because the heads are fused together quite well, and counts them as one boy.
When the configuration is switched to A, this twin head is separated. There are no more Siamese heads sharing a body, and that separation is what keeps the apparent head count the same, even though a head is shifted out in compensation for a leg shifted in.
Another noteworthy feature is that when the boy pair is formed, it is also Siamese twins, sharing one leg. So in the A configuration we have Siamese twins sharing a leg, which gets counted as two people, but in the B configuration, we count Siamese sharing an entire body as one person, because the heads are so well fused as to almost look like one.
If you consistently count all instances of Siamese twins as either two people, or else as one person, then the count is consistently 13 or consistently 12.
The paradox here rests in a kind of "visual equivocation fallacy". The equivocation fallacy is that, during the course of counting boys around the circle in the two configurations, the observer's definition of whether a Siamese twin is one person or two changes, due to visual deception. Well-fused heads count as one person, but joining at the hip and sharing a leg counts as two people.