They know exactly what you're doing.
Because it turns out that dogs can count.
As Susan Milius explained in an article for Science News, research suggests that dogs understand the concept of addition and subtraction.
In a 2002 study, Susan notes, dogs were shown a single treat in a bowl.