What molar quantity is represented by #3.011xx10^23*"magnesium atoms"#?
If I have a half a dozen magnesium atoms, how many atoms would that be?
And this question is PRECISELY the same as the one you asked EXCEPT that we use
And so we take the product...
which equals to half of Avogadro's constant.