They are a combined total of 520 horses and chickens on a farm, and they have a total of 1412 legs. How many horses and how many chickens are ther.