The atomic number gives you the number of protons element x has. Since the mass of protons and neutrons are almost similar(around 1 amu), the mass number can be thought of as the sum of protons and neutrons. so if element x whose atomic number is 40 has a mass number of 82, then we know that 42 of those must be neutrons.