Repeat N times with a template