Nuclear physics is not an easy subject and you need some advanced quantum mechanics to really understand some things, but you can think this way: Is not the fact that what you can have or not, you want stability, and that is, if there is some possible decay that will lead to a less energy state, you probably won't find this in nature. Then, neutrons have a bigger mass than protons, and with beta decay, you can transform a neutron to a proton (emitting other particles). Then seams reasonable to search some equilibrium between having sufficient neutrons to keep the nucleus hold together but having the minimum mass.
You can read about the
semi-empirical mass formula that predicts $$\frac{N}{Z}\approx1+0.02(N+Z)^{2/3}$$ where ##N,Z## are the number of neutrons and protons respectively.