Oxygen is group 8 element, so, the atom of oxygen has 8 protons and 8 electrons. The ion has the same number of protons because you never lose a proton to make an ion. But in the case of oxide form, it carries two negative charges. Negative charge come due to the transfer of electron. Therefore the number of electrons is 10.