An atomic number is the number of protons in the nucleus and that is what determines the identity of an element. The mass number is the total of protons and neutrons in the nucleus. An element has a distinctive atomic number but many elements can have the same mass number.
For example:- Carbon-12 has an atomic number of 6 and a mass number of 12.
Nitrogen-12 has an atomic number of 7 but mass is 12.
Oxygen-12 has an atomic number of 8 but mass number is still 12.
By the way, the atomic number is initially nothing to do with protons in the nucleus but come out from the study of how elements scattered X rays