Each energy shell can hold up to a certain “magic number” of protons or neutrons, but all nucleons within the shell must be of different quantum states. If all the quantum states for that shell are already taken, then they will go to the next available shell. The magic numbers are 2, 8, 20, 28, 50, 82, and 126 – indicating the number of nucleons possible in each of the shells. If an atom happens to contain a magic number or protons or neutrons it is found to be very stable, and these also correspond to atoms that are the most prevalent in the environment. An example would be element 10 (2 for the first shell plus 8 for the second shell). Element 10 is neon which is a stable nucleus.
If an element has both a magic number of protons and a magic number of neutrons it is “doubly magic”, and has a tightly bound nucleus. An example would be Lead-208, which has 82 protons and 126 neutrons. Heavy elements like lead (Pb) usually have more neutrons than protons since the electrostatic repulsion of the protons needs to be balanced out by more neutrons which provide the strong nuclear force to keep the nucleons bound together.
References:
1. The Nuclear Shell Model; University of Nebraska
2. The Nuclear Shell Model: University of California
3. The Nuclear Shell Model – Wikipedia