Picture the nucleus as a bag of marbles in two colors that weigh almost the same: protons and neutrons, each about 1 u. The mass number is simply the count of marbles in the bag. Carbon-12 holds 6 protons and 6 neutrons, so A=12; carbon-14 holds 6 protons and 8 neutrons, so A=14. You can't have part of a nucleon, so A is always a whole number.
Electrons are left out of the count. Each weighs about 0.00055 u, so even uranium's 92 electrons add only about 0.05 u to a nucleus of 238 nucleons. In the symbol ZAX, the top number is A and the bottom one is Z; subtract them to get the neutrons. Since Z is fixed by the element, a different A always means a different number of neutrons, which is a different isotope.
Mass number is a count for one atom; atomic mass is a weighted average for a natural sample. Chlorine atoms have mass number 35 or 37, never 36, yet the periodic table lists 35.45 because about 76% of chlorine atoms are chlorine-35 and 24% are chlorine-37. A decimal means you are looking at atomic mass; a question about one particular nucleus needs the whole number A.
Think of it like this. A mass number is a headcount of everyone on a bus, with protons and neutrons each counted as one passenger. It tells you how full the bus is, not which route it runs; the route, meaning the element, is set by the protons alone. Electrons are like birds perched on the roof: too light to count.
Core idea. Mass number counts the protons and neutrons in one nucleus. Because each weighs about 1 u, it is a whole-number estimate of the atom's mass, and with A=Z+N it lets you find any missing particle count.