Meromorphic functions on $X(1)$ are rational functions of $j$

151 Views Asked by At

I'm reading the proof given by Diamond and Shurman that the field of meromorphic functions on $X(1)$ is the set of rational functions of $j$ and it seems I'm missing something.

Starting with $f$ meromorphic and nonconstant on $X(1)$, they construct a function $g$ that is a rational function of $j$ having the same poles and zeros as $f$ on the upper half-plane. They then say that this implies that both functions vanish to the same order at infinity because "for both functions, the total number of zeros minus poles is 0". Why is that last part true?