Detailed Instructions: The task is to generate the correct answer for a given math problem.
Q: Problem: a certain number of horses and an equal number of men are going somewhere . half of the owners are on their horses ' back while the remaining ones are walking along leading their horses . if the number of legs walking on the ground is 40 , how many horses are there ?
A:
8