Initially they didn't measure numbers of protons and neutrons, just compared number of moles with mass. Such measurements are relative, that is, they required to define one of the elements (or better: isotopes) as a reference. At present the reference is C12.