Somehow, I suspect the answer to be gcd(n,m), because I read it somewhere.But I actually want to have an idea of how to get there.
I sure ..
call theta (f).
Then f(1)=1 since you assume it was a ring homomorphism. But how can we get to the point of saying that all homomorphism must be determined by f(1). There must be some cases. For instance m>n, n>m or m=n or Don't m and n have to be such that (n,m)=1. How many homomorphism can one get in each case. Are you saying they will all be determined by f(1)?