The filling of the shells and subshells with electrons proceeds from subshells of lower energy to subshells of higher energy. This follows the n + ℓ rule which is also commonly known as the Madelung rule. Subshells with a lower n + ℓ value are filled before those with higher n + ℓ values. In the case of equal n + ℓ values, the subshell with a lower n value is filled first.