This is an easily presented problem that requires a bit of thinking as it's not necessarily obvious to pupils what needs to be done to obtain an answer. It demonstrates the power of trial and improvement, combined with a systematic approach and you could also use children's work to focus on different ways of representing a solution.
You might choose to start this activity by counting the children's legs - bring a group up to the front of the classroom and ask how many children there are, and then count the legs. What can they say about the numbers? If you told them how many legs there were, could they tell you how many children? Emphasise the connection and the inverse. (It's a good idea to resist the temptation to record
this centrally so that in the later task children don't have a preconceived idea of how to record, and so may be inventive.)
Having helped the children to make the connection between children (heads) and legs, you could then introduce the idea of animals with different numbers. Which animals have two legs? Which have four? Do they know of any animals which have another number?
Then introduce the idea of two different animals. How many legs would a hen and sheep have altogether? If we know how many hens and how many sheep, can we work out how many legs? What about the other way round? Take some suggestions and then offer the task to the class.
Children could work in pairs or small groups. Once they have spent some time on the task, share different children's approaches and ways of recording. Look for children who have a system to their work, or identify a pattern in the solutions.