What is the molarity (M) of an HCl solution, 150 ml of which when treated with excess magnesium liberates 3.5 l of H2 gas measured at STP?

I know molarity is Moles, volume, but how does magnesium come into play?