Apparently both these equations can't be right at the same time, number of objects and weight of objects are not the same thing.
Mass of the nucleus equals mass of the neutrons plus mass of the protons MINUS binding energy.
Neutrons and protons hold very strong to each other in nucleus. When you take several separated neutrons and several protons and you fuse them into a nucleus a lot of energy is emitted (that's where the energy in stars and hydrogen bombs comes from). You have probably heard about Einstein equation E=mc2
- it means energy is equivalent to mass. When the energy is emitted, mass of the remaining nucleus is smaller than the sum of masses of protons and neutrons, this missing mass is called "mass deficit" or "binding energy".