How do you determine number of subatomic particles for a element?

Number of protons = Number of electrons = Atomic number

Number of neutrons = Mass number - Number of protons