Because the total of neutron and proton/electron is the atomic mass. So if you wanna find proton/electron and you know the neutron, just minus the atomic number with the neutrom and you will get the proton
Here if you need the formula
Atomic number = Total neutron + Total proton or electron