There are 13 animals in the barn. Some are chickens and some are pig's. There are 40legs in all. How many of each animal are there?