A bakery sold apple pies for $11 and blueberry pies for $13. One Saturday they sold a total of 38 pies and collected a total of $460. How many apple pies did they sell and how many blueberry pies did they sell?