Counting of objects in a stack thereof