how many electrons does each group lose or gain?

In the main group, the common valence is the same as the group number.