Answer:
Looking at the periodic table, the first period (H, He) has valence electrons at n = 1.
The second period has valence electrons at n = 2. etc.
Thus for Li it is 2; Na, Mg, Cl it is 3; Ga, Kr it is 4; I, Te it is 5.
This rule only applies to representative elements (All of these elements are representative elements) So we do not consider outer electrons in completely filled d or f subshells to be valence electrons.
For transition metals it is different, outer electrons in a completely filled f subshell shouldn't be considered as valence electrons. But those in the d subshell can be. For example, for cobalt, it has 9 valence electrons, 7 in
n = 3 and 2 in n = 4. the valence electrons are in two different energy levels.