Flexi Says: When ions form, they conform to the octet rule by either losing or gaining electrons in order to achieve the electron configuration of the nearest noble gas. In a similar way, nonmetal atoms share electrons in the formation of a covalent in bond such a way that each of the atoms involved in the bond can attain a noble-gas electron configuration. The shared electrons are “counted” for each of the atoms involved in the sharing. For hydrogen (H2), the shared pair of electrons means that each of the atoms is able to attain the electron configuration of helium, the noble gas with two electrons. For atoms other than hydrogen, the sharing of electrons will usually provide each of the atoms with eight valence electrons.