Charge ion for Mg is 2+
While 2+ is represents two electrons that had been released. It donors two electrons to oxide ions as oxide ions are 2-. 2- is represents as electron acceptor for two electrons. At the end, the empirical formula for this reaction is Mg2O2