<P> Cervantes probably adapted the story of counting goats from a story of counting sheep in the early twelfth - century Spanish work Disciplina Clericalis . The section The King and his Story - teller (section 12) uses the idea of counting sheep humorously . Disciplina Clericalis draws mainly on literary sources from the Islamic world . Counting sheep was probably a widely recognized practice in the Islamic world before the early twelfth century . </P> <P> Serta, an American mattress manufacturer has had their own herd of "Counting Sheep" used in advertisements for the company since at least 2000 and have even sold plush toys of the sheep . </P> <P> Shaun the Sheep entitled its 2012 series "Championsheeps" to celebrate the London Olympics . The episode "Steeplechase" featured Shaun and his fellow sheep participating in the steeplechase event . Blitzer the dog, who was referee, and the other sheep and farm animals, who were spectators, all fall asleep watching Shaun and the other sheep running around the track and jumping over the hurdles . </P> <P> Toolkit7 added sheep counter to their fun tools section . There are also many sheep counting applications for mobile phones and games for consoles . </P>

Where did counting sheep to fall asleep come from