this may seem an easy quetsion but i really need your help

here's the question:

John bought a certain number of apples at 30 cents each and he had $ 3 left. If he bought the same number of pears at 40 cents each instead of the apples, he would be short of $ 1. How many apples did he buy?