How do you calculate the distance of a galaxy?