How to count clustered galaxies