Generating functions and double counting and examples