Photon-number-state generation with a single two-level atom in a cavity: a proposal