We present a general method for estimating the number of particles impinging on a segmented counter or, in general, on a counter with sub-units. We account for unresolved particles, i.e., the effect of two or more particles hitting the same sub-unit almost simultaneously. To achieve full time resolution we account for the dead time that occurs after the first time-bin of a particle signal. This general counting method can be applied to counting muons in existing detectors like the Underground Muon Detector of the Pierre Auger Observatory. We therefore use the latter as a study case to test the performance of our method and to compare it to other methods from literature. Our method proves to perform with little bias, and also provides an estimate of the number of particles as a function of time (as seen by the detector) to a single time-bin resolution. In this context, the new method can be useful for reconstructing parameters sensitive to cosmic ray mass, which are key to unveiling the origin of cosmic rays.