Why do the gas giants have more moons than the terrestrial planets?