We propose a setup capable of generating Fock states of a single mode radia
tion field. The scheme is based on coupling the signal field to a ring cavi
ty through cross-Kerr phase modulation, and on conditional ON-OFF photodete
ction at the output cavity mode. The same setup allows to prepare selected
superpositions of Fock states and entangled two-mode states. Remarkably, th
e detector's quantum efficiency does not affect the reliability of the stat
e synthesis.