2HCl + Mg -> MgCl2 + H2
The balanced chemical equation shows that 1 mole of magnesium reacts with 2 moles of hydrochloric acid to produce 1 mole of magnesium chloride and 1 mole of hydrogen gas.
Therefore, if you have 36 moles of hydrochloric acid, you would need 18 moles of magnesium to react with all of it, and this would produce 18 moles of magnesium chloride.