$f : [a,b] \to \mathbb R$ is continuous, let $M(y)$ be the number of points $x$ in $[a,b]$ such that $f(x)=y$. prove that $M$ is Borel masurable and $\int M(y)dy$ equals the total variation of $f$ on $[a,b]$
This is an exercise in 'real analysis for graduate students'(Richard.F.Bass)
At first time, I thought $M(y)=\mu(\{x \mid f(x)=y\})$ where $\mu$ is counting measure. But I cannot find the relation between Borel measurability and $\mu(\{x \mid f(x)=y\})$
Is there anyone would help me?