A man bought a number of articles at an equal cost for \$500. He sold all but two for \$540, making a profit of \$5 on each article sold. How many articles did he buy? Let's think step by step and output the final answer within \boxed{}.
user