If you had only two magnesium nitrate molecules how many atoms of each element would you have? You can just draw this situation on a piece of paper and count up the atoms. For instance you would have something like this on your paper (for two Mg(NO3)2): Mg, Mg, N, N, N, N, O, O, O, O, O, O. Now just do the same for a mole...just kidding but you should be able to see the relationship of number of moles of a given molecule and the number of moles of the constituents of the molecule. It's important to remember that for problems such as these we aren't concerned with structure or anything fancy. You can just as well write MgN2O6 or the long way that I have above and you would be able to work out the problem. The way it is written in the question will give much more information which isn't necessary for this particular problem but which is useful for a Chemist IE we know the anions are nitrates, a well known molecule important in a lot of chemical processes.
A useful exercise may be to do analogous thought experiments with everyday objects you are familiar with. For instance how many tires do 4 cars have? How many steering wheels? how many rearview mirrors? How did you figure that out? How about a mol of cars?