A merchant purchases two lots of shoes. One lot he purchased for $32 per pair and the second lot he purchased for $40 per pair. There were 50 pairs in the fist lot. How many pairs were in the second lot if he sold them all at $60 per pair and made a gain of $2800 on the entire transaction?