Let $\displaystyle $Hom$\{\mathbb{Z}_n, \mathbb{Z}_m\}$ denote the group of homomorphisms between $\displaystyle \mathbb{Z}_n$ and $\displaystyle \mathbb{Z}_m$. Show that $\displaystyle |$Hom$\{\mathbb{Z}_n, \mathbb{Z}_m\}|=$gcd$(m,n)$.

The only thing I have is that since we're dealing with a homomorphism that $\displaystyle |\phi(a)|$ divides $\displaystyle |a|$, but I don't see how that fact gets used to prove the above statement.