From what I understand the number of homomorphisms from $Z_m$ to $Z_n$ is the gcd(m,n)
However, I do not know how to count it this way:
use the Fundamental Theorem on Group Homomorphisms (i.e., find a quotient group of $Z_{12}$, a subgroup of $Z_{16}$, and an isomorphism between them)
Both the groups are given as cyclic groups. In such case there is a unique subgroup and unique quotient group for every order that divides the order of the given cyclic group.
So we need to look for numbers that divide both $m$ and $n$. Now it is known that $d$ is a common divisor of $m$ and $n$ iff $d$ divides their gcd.