Farmer Tom raises ducks and horses on his farm. All of his horses need new horseshoes. He calls the farrier (a person who puts shoes on horses) but has a difficult time remembering how many of each animal he owns. He knows that there are a total of 24 animals. The animals have a total of 62 legs (all animals have either two or four legs). How many horses does Tom own?