document counting works