Let $Z$ a compact set and $X$ a locally compact set. Let $p:Z\to X$ a local homeomorphism. Show that there exists $n≥1$ and $U_1,…,U_n$ open and closed sets of $X$ such that :

 - $X=\sqcup_{i=1}^{n}U_i$
 - the map $x\in X \mapsto \text{Card}(\rho^{-1}(\{x\}))$ is constant on $U_i$ for all $1≤i≤n$

I have already proved that the map $x\mapsto \text{Card}(\rho^{-1}(\{x\}))$ is continuous on $X$ but i don't know how to continue ... I also thought of a proof by induction on $n=\text{sup}\{\text{Card}(\rho^{-1}(\{x\})),\: x\in X\}$ which is clear for $n=1$.

Thank you for you help