Using single photons as qubits has become a prominent strategy in quantum information technology. Accurately determining the number of photons is crucial in various quantum systems, including quantum computation, quantum communication, and quantum metrology.