# Question about the relation between two different ways of definition the degree of map

I am learning the Riemann Surfaces and I have a question when I read the appendix A.1.5. of textbook A course Complex analysis and Riemann surfaces by W.Schlag.

One way to define the degree of the non-constant and analytic map $f$ between Riemann surfaces is that $$\deg(f) := \sum_{p\in f^{-1}(q)}(b_{p}(f)+1),$$ where $p$ is a branch point and $(b_{p}(f)$ barnch numbers.

And the other notion of the degree from topology,

Let $f: M \to N$ be a smooth map and $f^{*}: H^{n}(N) \to H^{n}(M)$ the induced map defined via the pullback. There exists a real number denoted by $\deg(f)$ s.t. $$\int_{M} f^{*}(\omega)=\deg(f) \int_{N} \omega,\ \forall \omega \in H^{n}(N).$$

For the Riemann surfaces $n=2$, hence the definition of the degree is that $$\int_{M} f^{*}(d\sigma)=\deg(f) \int_{N} d\sigma,\ \forall d\sigma \in H^{2}(N).$$

$\textbf{My question}$ is that why it is easy to verify that for any $\textbf{regular}$ value $q\in N$, which means that $Df(p): T_{p}M \to T_{p} N$ is invertible for every $p$ with $f(p)=q$, $$\deg(f)= \sum_{p\in f^{-1}(q)} Ind(f;p),$$ where $Ind(f;p)=\pm 1$ depending on whether $Df(p)$ preserves or reverses the orientation.

First, observe that the first definition is valid at any given point $q$ and implies that the degree depends only on a neighbourhood of the fiber (since you look at the ramification indices to determine the degree).
For each point $p_i$ in the fiber let $U_i$ be a neighbourhood such that $f_i:=f_{|U_i}$ is a diffeomorphisme onto its image (local inversion theorem).
You can assume that all the $f_i$ have the same image V.
Let $\sigma$ be a differential 2-form. $deg(f) \int_V \sigma =\int_{\cup \, U_i} f_i ^{*}\sigma =\Sigma (\int_{U_i} f_i ^{*}\sigma )=\Sigma (\pm\int_V \sigma )$ where $\pm$ depends on if $f_i$ is orientation-preserving or orientation-reversing.
Since Riemann surfaces are orientable (see orientability of riemann surface), you have an oriented atlas over $M$ and $N$. You can always assume that each set is contained in such an atlas. If $dx^1\wedge dx^2$ in $V$ is sent to $\lambda \times dy^1\wedge d y^2$ in $U_i$ for some $\lambda>0$, $f_i$ is orientation-preserving. If not, it sends $dx^1\wedge dx^2$ to $-\lambda\times dy^1\wedge d y^2$ and is orientation reversing. If you are unfamiliar with differential geometry, think of it as being in $\mathbb{R}^2$ and applying the formula $\int_{U_i}f_i^*(g(x)dx^1\wedge dx^2)=\int_{U_i}\pm|det(J_{f_i}(y))|(g(f_i(y))dy^1\wedge\ dy^2)=$ $\int_{U_i}\pm|det(J_{f_i}(y))|(g(f_i(y))dy_1 dy_2=\pm\int_{V}g(x)dx_1 dx_2=\pm\int_{V}g(x)dx^1\wedge dx^2)$