Stellar structure

Why does hydrogen-to-helium fusion release energy even though the number of nucleons is conserved?