When non-metal atoms ionize they gain electrons.<span> Some examples of this are the halogen elements: F, Cl, Br and I, each, can gain one electron from the respective anions, F-, Cl-, Br-, and I-. O and S, may gain two electrons to form the anions O2- and S2-. This is due to the fact that those elements only need one (in the case of the halogens) or two (in the case of O and S) electrons to reach the most stable configuration of the closest noble gas (with the last shell of electrons full), so they are ready to gain those electrons and form the corresponding ions.</span>