A superconducting qubit in the strong dispersive regime of a circuit quantum electrodynamics system is a powerful probe for microwave photons in a cavity mode. In this regime, a qubit spectrum is split into multiple peaks, with each peak corresponding to an individual photon number in the cavity (discrete ac Stark shift). Here, we measure the qubit spectrum in the cavity that is driven continuously with a squeezed vacuum field generated by a Josephson parametric amplifier. By fitting the qubit spectrum with a model which takes into account the finite qubit excitation power, the photon number distribution, which is dissimilar from the apparent peak area ratio in the spectrum, is determined. The photon number distribution shows the even-odd photon number oscillation and quantitatively fulfills Klyshkos criterion for the nonclassicality.