Dear Student,
The element O has same number of sub-atomic particles
Number of electrons = 6
Number of protons = 6
Number of neutrons = 6
Magnesium Mg also has all sub-atomic particles equal
Number of electrons = 12
number of protons = 12
Number of neutrona= 12
Regards!