Let's define
$p$ \- regular prize of the apples per apple
$p^*$ \- reduced prize of the apples per apple
$n$ \- number of apples originally bought
Then we have the following equations:
$n\cdot p=12$ \- he payed 12 dollars
$(n+2)\cdot p^*=12$ \- he payed 12 dollars for two more apples with the fictional reduced prize
$p\cdot 12 = p^*\cdot12+1$ \- the price for a dozen apples is reduced by 1
Solving these equations leads to a quadatric equation which has two possible solutions $n=16$ or $n = -18$.
Please feel free to comment if you like to see the way to actually solve the equations not just the set up.