How is the variety of species related to the variety of niches in an ecosystem?