Formulae of ions
When metals lose electrons, they form positive ions, since they now have more protons than electrons. The charge on these ions is dependent on the number of electrons lost. So if the atom loses one electron, it has a +1 charge; if it loses two electrons, the charge is + 2 and so on.
Similarly, when non-metals gain electrons, they form negative ions, since they have more electrons than proton. So if the atom gained one electron it will have a -1 charge, similarly if it gained 2 electrons it will have a -2 charge.
Here is a list of ions below, please note how the charge on the ion is written on the top right of the atomic symbol.
Beryllium Be2+
Sodium Na1+
Oxide O2-
Nitride N3-
Bromide Br 1-