There is a difference between the meanings of atomic mass and mass number. One is the average weight of an element and the other is the total number of nucleons in the atom's nucleus.
Atomic mass is also known as atomic weight. Atomic mass is the weighted average mass of an atom of an element based on the relative natural abundance of that element's isotopes.
Mass number is a count of the total number of protons and neutrons in an atom's nucleus.
Hydrogen has three natural isotopes: 1H, 2H, and 3H. Each isotope has a different mass number.
1H has 1 proton. Its mass number is 1.
2H has 1 proton and 1 neutron. Its mass number is 2.
3H has 1 proton and 2 neutrons. Its mass number is 3.
99.98% of all hydrogen is 1H
0.018% of all hydrogen is 2H
0.002% of all hydrogen is 3H
Together, they give a value of atomic mass of hydrogen equal to 1.0079 g/mol.