Calculating the number of galaxies