How to identify the number of ions in a molecule
First, apply the swap and drop rule for charges
(Take for example Mg(NO3)2 -> swap+drop -> Mg^2+ NO3^- (bcs Mg's initial denominator was 1 and NO3's denominator was 2)
Then, add the absolute value of the charges together for the # of ions
Lastly, multiple it by Avogadro's number