Jim bought 16 articles. Some of them cost $2 each and the others cost $5 each. The total cost was $50. How many of each did Jim buy?