The ability to detect single photons with a high efficiency is a crucial requirement for various quantum information applications. By combining the storage process of a quantum memory for photons with fluorescence-based quantum state measurement, it is, in principle, possible to achieve high-efficiency photon counting in large ensembles of atoms. The large number of atoms can, however, pose significant problems in terms of noise stemming from imperfect initial state preparation and off-resonant fluorescence. We identify and analyse a concrete implementation of a photon number resolving detector based on an ion Coulomb crystal inside a moderately high-finesse optical cavity. The cavity enhancement leads to an effective optical depth of 15 for a finesse of 3000 with only about 1500 ions interacting with the light field. We show that these values allow for essentially noiseless detection with an efficiency larger than 93%. Moderate experimental parameters allow for repetition rates of about 3 kHz, limited by the time needed for fluorescence collection and re-cooling of the ions between trials. Our analysis may lead to the first implementation of a photon number resolving detector in atomic ensembles.