Recall that when elements lose or gain electrons, they become ions. We're going to say here that cations are positive ions, and we're going to say what that cat ion. We first remove electrons from the highest shell number, and the highest shell number is connected to our principal quantum number, or the N value.
Now the principal quantum number provides the shell number, or energy level of the electron. So here we have 1S22S22P63S23P6. The number is related to the principal quantum number. N1S2 would have an N value of 12S2 and 2P6 would have N values equal to two. 3S2 and 3P6 would have N values equal to three.
So just remember we look at the number before the sub level or subshell letters of SPD or F to determine our N value, and when we're removing electrons, we're going to remove them from the orbitals that have the highest N value. But let's say we wanted to remove electrons and we only had 3S2 and 3P6 to choose from. Both of them have the highest end value.
But we'd say that since 3P6 is listed after 3S2, it would have more energy and therefore if we had to choose between 3S2 and 3P6, we'd remove the electron first from 3P6. Same thing can be said between 2S2 and 2P6. Since 2P6 is listed after 2S2, it has more energy and therefore if we had to take electrons away, it'd come out of the 2P6 orbitals before we even look at the 2S2 orbitals.
So just remember, first look at the highest end value. If a set of orbitals have the same end value, then the higher energy one is the one that was listed last. That's where we would remove electrons first.