The chemical reaction would be written as:
2HgO = 2Hg + O2
We use this reaction and the amount of the reactant to calculate for the moles of oxygen produced. THen, we use avogadro's number to convert it to molecules. We do as follows:
12.5 g HgO (1 mol / 216.59 g) (1 mol O2 / 2 mol HgO) ( 6.022x10^23 molecules O2 / 1 mol O2 ) = 1.74x10^22 molecules O2 produced