particles in the atom
The mass number of an atom equals the total number of nuclear particles (nucleons).
The atom number of an atom equals the number of protons is the nucleus.
The mass of electrons can be neclected, compared to the mass of nucleons (protons and neutrons).
To determine the mass of an atom, you only need to count the number of nucleons: than you get the mass number.
That's why an atom will/must have the same mass as its fellow ion. That ion only has one or some electron extra or short, and they weigh about nothing.