Temporal array with superconducting nanowire single-photon detectors for photon-number resolution