They only count while they are in the air. Tap each sheep as it clears the fence — white or black, both count. Some of them are wolves wearing fleece: grey muzzle, yellow eyes, teeth. Count a wolf, or let a sheep past, and you lose a little of your attention.
Three lapses and the night is over.
Counting sheep is supposed to send you to sleep, not wake you up. If it stops being restful, stop playing and go to bed.