the number of ideal classes (the of "r") may be infinite in general. in fact, every abelian group is isomorphic to the ideal class group of some dedekind domain. but if "r" is in fact a ring of algebraic integers, then the class number is always "finite". this is one of the main results of classical algebraic number theory.