The Hubble Space Telescope UV legacy survey of galactic globular clusters – XVI. The helium abundance of multiple populations