The rule which was given by bohr and bury is that the maximum number of electrons that can accommodate in a shell is given by the formula 2 n square where n is the number of shell.
n=1 then, 2 multiplied by 1 square= 2 electrons.
similarly
in L shell 8 electrons
in M shell 18 electrons
in N shell 32 electrons
in O shell 50 electrons