Each individual (horse or person) has only one head so there are 22 individuals.
We know that horse have 4 legs while people only have two.
Let's guess and check
Let's say we do 11 people and 11 horses
11 people have 22 legs and 11 horses have 44 legs - That adds up to 66 legs which is two legs too many. We can't take a person away -2 because we would have to add a horse +4 which would even bring us further away from 64. We need to take a horse away -4 and add a person +2 and we will lose two legs
Final answer: 12 people and 10 horses
Check 12 people have 24 legs 10 horses have 40 legs -together they have 64 legs.
Problem solved.