Wrong subject. Expect that to be in chemistry.
Here it is:
One mole of a compound/element contains the weight in grams equal to the sum of the molecular mass.
For MgCL2,
Mg=24.30
Cl=35.45
so the molecular mass = 24.30+2*35.45=24.30+70.9=95.20 (approximately).
=>
One mole of MgCl2 weighs 95.20 g.
305 g of MgCl2 = 305/95.20 = 3.20 moles, to 3 significant figures
Edit: improved accuracy of atomic masses.