Even number of points in the preimage of a regular value of a map $f:M^n \to \mathbb{R}P^n$

Let $M^n$ be a closed manifold (I think we can also assume it is connected, though it isn't explicitly stated). Let $f:M^n \to \mathbb{R}P^n$ be a smooth map, and let be $a \in \mathbb{R}P^n$ be a regular value of $f.$ Then, since both manifolds have the same dimension, by the inverse mapping theorem $f$ is a local diffeomorphism near each $x \in f^{-1}(a),$ and so $f^{-1}(a)$ is discrete (hence finite by compactness of $M$).

I want to show the following: If $\pi_1(f)$ is the zero map, then $f^{-1}(a)$ has an even number of points.

I've been thinking about this for a while, but I don't see the idea behind the proof yet. The cases $n=1$ and $n \geq 2$ seem quite different: when $n=1$ then we're really looking at maps $f:S^1 \to S^1$ of degree zero; intuitively such a loop needs to pass through a regular point an even number of times in order to end at its starting point. For the case $n \geq 2$ we have $\pi_1(\mathbb{R}P^n) = \mathbb{Z}/2.$

Since $\pi(f) = 0,$ by the lifting theorem we know that there exists a lift $g:M \to S^n$ of $f$ (i.e. $f = p \circ g$ where $p:S^n \to \mathbb{R}P^n$ is the canonical map). So it seems like the "evenness" of points in $f^{-1}(a)$ should come from the antipodal action on $S^n$ somehow.

I'd be glad if someone could give me a hint in the right direction.

Here's another argument: Every regular value $a \in \mathbb{R}P^n$ of $f$ corresponds to a pair of regular values $b,-b \in S^n$ of the lift $g: M^n \to S^n$, and $$|f^{-1}(a)|=|g^{-1}(b)|+|g^{-1}(-b)|.$$ Since the mod-2 degree of a smooth map is given by the cardinality (modulo 2) of the preimage of any regular value, we have $$|f^{-1}(a)| = |g^{-1}(b)|+|g^{-1}(-b)| \equiv 2\deg_2(g) \equiv 0 \quad \operatorname{mod} 2.$$
Let $y$ be the generator of $H^1(\mathbb RP^n, \mathbb Z_2)$. Then $y^n\in H^n(\mathbb RP^n, \mathbb Z_2)$ is the fundamental class of $\mathbb RP^n$. The inverse image $f^*(y^n)$ is equal to either zero or the fundamental class $x\in H^n(M^n,\mathbb Z_2)$.
More generally, given the smooth map $f$ between smooth connected closed manifolds $M$ and $N$ of the same dimension $n$, the pullback map $f^*\colon H^n(N, \mathbb Z_2)\to H^n(M, \mathbb Z_2)$ is zero iff the number of preimages of any regular value in $N$ is even. So we need to show that in our case $f^*(y^n) = 0$. Note that $f^*(y^n) = f^*(y)^n$, so it is enough to show that $f^*(y)=0$.
Since $f_*\colon \pi_1(M)\to\pi_1(\mathbb RP^n)$ is zero, the same holds for $f_*\colon H_1(M,\mathbb Z_2)\to H_1(\mathbb RP^2, \mathbb Z_2)$, because every element of $H_1(M, \mathbb Z_2)$ may be realized as a union of closed curves. This means that the value of cochain $f^*(y)$ on any 1-cycle in $H_1(M, \mathbb Z_2)$ is zero. The pairing between homology and cohomology of given dimension in given space is always non-degenerate, so we have $f^*(y)=0$ and therefore $f^*(y)^n = f^*(y^n) = 0$.