if you want to calculate the maximum number of electrons that can be held in any shell, it’s 2n^2where n is the order of the shell from the nucleus.
Here, n=3 in the 3 rd shell
So, 2n^2=2*(3)^2=18, it is the maximum number of electrons that can be held in that shell
So…2, 8, 18, and 32 are the maximum number of electrons that can be held in the 1st, 2nd, 3rd, and 4th shells, respectively; but they are not indicative of the number of electrons found in the shells of actual atoms