Synthesis of Fock states via beam splitters