One possibility would be to first extract the ion chromatograms for all detected peaks and then count the number of data points in each:
## Subset to one file, assuming xdata is an XCMSnExp with identified chrom peaks
xdata_1 <- filterFile(xdata, 1)
chrs <- chromatogram(xdata_1, rt = chromPeaks(xdata_1)[, c("rtmin", "rtmax")],
mz = chromPeaks(xdata_1)[, c("mzmin", "mzmax")])
head(lengths(chrs))
## median number of scans for all peaks in a the file
median(lengths(chrs))
Note: this should be done separately for each file, hence the filterFile step.