By mass, the sun is 70% hydrogen, 28% helium, and 2% other elements. The sun's total mass is 1.989e30 kg. 2% of that is 3.978e28. The Earth's mass is 5.972e24. So, there's over 6,600 Earths-worth of elements heavier than helium inside the sun.
As mentioned previously, free hydrogen & helium on Earth can escape into space more readily than it can on more massive planets like the gas giants.