Answer
Two electrons have been transferred in this reaction.
Work Step by Step
As we show in part (a), $Mg$ would be willing to lose its 2 valence electrons so that it could reach an octet, while $O$ would also be willing to accept 2 electrons from $Mg$ so that it could reach an octet.
Therefore, we could see that 2 electrons have been transferred in this reaction.