We had a cat that could count. She would show at the dining table during desert because she knew she was allowed to "clean" the desert plates. As soon as somebody finished, she got the plate ( or bowl ).
This cat retreated to her lair after she got all plates, whether there 2, 3 or 4 persons at the table.
Other cats in the household developed the same pattern ( showing up, cleaning plates ). But these cats had to signaled explicitly there was none left, otherwise they would stay around and keep asking.