The answer to this question would be: They subtract the atomic number from the atomic mass.
An atom mass is made from its nucleus which was only proton and neutron since electron mass is too small. Atomic number is the number of protons, so if you subtract the atomic mass with atomic number you will definitely find the number of neutrons