The set of points reached exactly $n$ times is measurable

Let $$p:X \to Y$$ be a measurable surjection and assume that for each $$y \in Y$$ the set $$p^{-1}(y)$$ is at most countable. Define $$Y_n$$ (for $$n \in \mathbb{N} \cup \{ \infty \}$$) to be the set of those $$y \in Y$$ for which there are exactly $$n$$ distinct $$x \in X$$ such that $$p(x)=y$$. Is it clear that each $$Y_n$$ is measurable?

EDIT: I forgot to add, $$X,Y$$ are assumed to be standard Borel spaces: i.e. sigma algebras are the sigma algebras of Borel set and $$X$$ and $$Y$$ are assumed to be complete, separable metric spaces

• Sure, You are right: I forgot to add that $X,Y$ are standard Borel spaces. I'm sorry – truebaran Oct 20 '18 at 13:33
• What about taking Y to be the reals R, and X to be a disjoint union of R with R, and p the identity on one copy of R, and on the other copy some example of a measurable map from R to R that doesn't have a measurable image. Then take n = 2. – Lorenzo Najt Oct 20 '18 at 14:25
• @Lorenzo is X a complete metric space? – Tim kinsella Oct 20 '18 at 14:30
• I guess it doesn't matter. You can just do what you said on two halves of $\mathbb{R}$. Provided there exists an injective measurable map whose image isn't measurable, as you say. – Tim kinsella Oct 20 '18 at 14:48

As in the answer I provided in MO, this follows from Exercise 18.15 in Kechris' Classical Descriptive Set Theory, which states (adapted to your notation) what you need that but for a subset $$P\subseteq Y\times X$$ with countable sections $$P_y$$ (you can take $$P:=(\mathrm{graph}(p))^{-1}$$).
For $$n=0,\dots,\infty$$, 18.15 says that $$Y_n$$ is Borel and there are Borel functions $$f_i^{(n)}:Y_n\to X$$ with disjoint graphs such that for $$x\in Y_n$$, $$p^{-1}(x) = \{f_i^{(n)}(x) : i . This exercise follows from the Lusin-Novikov Theorem (18.10 in the same book) that states the projection of such a $$P$$ must be Borel in $$X$$.