Question: how to determine how many valence electrons there are?
Answer: For neutral atoms, the number of valence electrons is equal to the atom's main group number. The main group number for an element can be found from its column on the periodic table. For example, carbon is in group 4 and has 4 valence electrons. Oxygen is in group 6 and has 6 valence electrons.