In the following reaction, which substance is being oxidized and which is being reduced? Show your work in finding the answer.

2Mg(s) + O2(g) --> 2MgO