Question: how do you know how many electrons are in the outer shell?
Answer: Valence electrons can be found by determining the electronic configurations of elements. Thereafter the number of electrons in the outermost shell gives the total number of valence electrons in that element.