Define a cover mapping $f:Y\to X$ so that for all $x\in X$ the set $f^{-1}(x)$ is finite. Define a function $g:X\to \mathbb{Z}$ with $g(x) = \# (f^{-1}(x))$, as in: the number of elements in the set $f^{-1}(x)$.
I'm asked to proof that there is an open neighboorhood $U$ of $x$ in $X$ such that $g(x')=g(x)$ holds for all $x'\in U$.
What I've got so far:
Let's take a random open neighboorhood $U$ of $x$ in $X$. I know that since $f$ is a cover mapping, $f^{-1}(U)$ is the distinct union of a family of open subsets of $Y$, and $f^{-1}(x) \subseteq f^{-1}(U)$ for all $x\in U$. I've got no clue how to go on from here. Can anyone provide some help?
Given $x\in X$, we find open $U\ni x$ such that $V:=f^{-1}(U)$ is of the form $V=\bigsqcup_{i\in I}U_i$ where $U_i\subseteq Y$ is open and $f|_{U_i}\colon U_i\to U$ is a homoeomorphism. Then $f^{-1}(x)$ intersects each $U_i$ exactly once, which means that $I$ has precisely $g(x)$ elements. Then for any $x'\in U$, we have that $f^{-1}(x')$ intersects each $U_i$ exactly once, which means that $g(x')=|I|=g(x)$.