Given my cat has figured out how to open three different kinds of doors (handle, slidding, and even knob) I'm sure they can figure that out.
Hell, my cat seems close to figuring out how to turn on our fire place. She goes and sits by the switch (out of her reach) and meows until we turn it on, then runs across the room to lay by it.
I'm confident given sometime they can count as well. Likely this would help them catch mice and what not, if they know how many there are.