Photon-number discrimination without a photon counter and its application to reconstructing non-Gaussian states