Atomic number: proton count
Atomic number Z counts the protons in an atomic nucleus. It fixes the element identity. All carbon nuclei contain six protons, regardless of isotope or charge.
Mass number: one isotope
Mass number A is the total number of protons and neutrons in a particular nucleus. Carbon-12 has six protons and six neutrons. Carbon-14 has six protons and eight neutrons.
Finding the neutron count
For a specified isotope, neutrons equal A minus Z. Do not subtract atomic number from a rounded decimal atomic weight and assume the result identifies a real isotope.
Charge changes electrons
A neutral atom has as many electrons as protons. A positive ion has fewer electrons and a negative ion has more. Gaining or losing electrons changes charge, not atomic number.
Average mass is different again
A published atomic weight may reflect the isotopic composition of a material. It can be a decimal or an interval. This is why the mass shown on a general periodic-table tile is not interchangeable with the integer mass number of a chosen isotope.
Further reading: PubChem Periodic Table and IUPAC periodic table resources.