A farmer has both ducks and pigs in a pen together. There are a total of 22 legs in the pen, If there are 7 animals in the pen, how many of each type of animal are in the farmer's pen?

28