It is the rule (a rule for determing electronic configuration) which is to be followed for the filling of the no. of electrons where n is the shell number
K shell - 2(1^2)= 2 electrons
L shell - 2(2^2)=8 electrons
M shell - 2(3^2)= 18 electrons
N shell - 2(4^2)=32 electons
There is one more rule which you need to follow that the last shell or the valence shell can at max occupy 8 elctrons not more than 8…
For instance if the valence shell is N shell then it can not have 32 electrons rather it can have 8 have elctrons..