The N = 1 shell contains 2 electrons.
The N = 2 shell contains 10 electrons.
The N = 3 shell contains 18 electrons.
How many have been used up so far?
How does the N = 2 shell contain 10 electrons?
It doesn't, of course. I added 2 from N=1 to the 8 in N = 2 and my brain was working faster than my fingers could type so I typed in 10.
Let's do it right. First, you are correct about 2,8,18, 32, and 50; HOWEVER, that is the MAXIMUM number of electrons that any one shell can hold. It isn't the number you may expect to find in any one shell BECAUSE the shell does NOT have to be filled completely before the next higher shell starts filling. That makes things interesting. ;-).
If we use orbitals, they fill this way.
1s2 2s2 2p6 3s2 3p6 4s2 3dx.
The magic number for this question is 25 so let's count where we are and the remainder will go into 3d orbital.
So far we have 20; therefore, 5 must go into 3d so the final tally would look like this.
1s2 2s2 2p6 3s2 3p6 3d5 4s2 and the answer to the posted question is 4 (from the 4s2). This is an example of what I talked about above. Note we have 2 in n = 1, 8 in n = 2, and we have 13 in n = 3 (it can hold 18) BUT 2 electrons have already entered the n = 4 level. Isn't chemistry interesting?
Do you know how to predict the number of electrons in the 3d orbital (with only two exceptions)? Use Dr Bob's rule!
The number of electrons in the 3d orbital is the same as the second number of the atomic number. Sc is 21, it has 3d1 (and 4s2).
Ti is 22; it has 3d2 4s2
V is 23; it has 3d3 4s2
Cr (one exception) is 24; it has 3d5 4s1
Mn is 25; it has 3d5 4s2
Fe is 26; it has 3d6 4s2
Co is 27; it has 3d7 4s2
Ni is 28; it has 3d8 4s2
Cu is 29; (second exception); it has 3d10 4s1