The optical-to-electrical conversion, which is the basis of optical
detectors, can be linear or nonlinear. When high sensitivities are needed
single-photon detectors (SPDs) are used, which operate in a strongly nonlinear
mode, their response being independent of the photon number. Nevertheless,
photon-number resolving (PNR) detectors are needed, particularly in quantum
optics, where n-photon states are routinely produced. In quantum communication,
the PNR functionality is key to many protocols for establishing, swapping and
measuring entanglement, and can be used to detect photon-number-splitting
attacks. A linear detector with single-photon sensitivity can also be used for
measuring a temporal waveform at extremely low light levels, e.g. in
long-distance optical communications, fluorescence spectroscopy, optical
time-domain reflectometry. We demonstrate here a PNR detector based on parallel
superconducting nanowires and capable of counting up to 4 photons at
telecommunication wavelengths, with ultralow dark count rate and high counting
frequency