Maximum number of electrons in a sub-shell of an atom is determined by the following.