Call

Subshell notation of magnesium is 2.8.2.

We know that magnesium is in Group 2, Period 3. Hence it has an energy level of 3.

By doing this, we can start listing out the of magnesium.

$1s^2$$2s^2$$2p^6$$3s^2$

For any other , simply write down the total number of electrons. You will realize that once you finish writing the electron configuration, the numbers will add up the the number of electrons of the element you want to find.