counting with generator