2 atoms?
The group number (valency) determines how many electrons the atom wants to share as they all want to bond to achieve the noble gas configuration.
From groups 1-4 (the top number in the periodic table), that is how many they want to gain, and 5-7 six minus the number is how many they want to gain. Group 8 are noble gases so already have a full outer shell.