This is really easy. The key is to look at every part attentively.
You see, this GIF is like a three pieces puzzle. Two on the top, one at the bottom.
Let's say the pieces on the top are X and the one at the bottom is Y.
The top piece with 7 body parts is 1-a and the top piece with 5 body parts is 1-b.
X-a : 7 body parts
X-b : 5 body parts
Y : 12 body parts
X-a + X-b = 12 body parts.
So it means that every body parts in X have to replace one body part in Y.
If you look carefully, you can see the missing hair and the incompletely feet on the left side of image when X-a switches with X-b. It mean that the one who is missing 1/2 of his feet (who is supposed to replace the missing hair one) replaces no one.