I can only answer the question for continuous functions, but I hope that this is a start. As I mentioned in my comment, I suspect that the statement of your question needs to be modified: I would expect $N$ to be measurable at least for Borel measurable functions and if $f$ is measurable and of bounded variation then I think $\int N$ should give the total variation of the continuous part of $f$ in the Lebesgue decomposition. Maybe a refinement of the argument below yields the result for general functions of bounded variation, but admittedly, I don't see how to do that at the moment.

The argument I present is Banach's, as given in Sur les lignes rectifiables et les surfaces dont l'aire est finie, Fund. Math. 7 (1925), 225–236 (Théorèmes 1 and 2), which I reproduce here for the convenience of the readers who don't read French.


Let $f\colon [a,b] \to \mathbb{R}$ be a continuous function and for $t \in \mathbb{R}$ let $N(t) = \# f^{-1}(t)$.

a) The function $t \mapsto N(t)$ is measurable.

For $k \geq 1$ partition the interval $[a,b]$ into $2^k$ intervals $I_{1}^{(k)},\ldots,I_{2^k}^{(k)}$ of length $2^{-k}(b-a)$. For $y \in \mathbb{R}$ and $1 \leq n \leq 2^k$ let $$ L_{n}^{(k)}(t) = \begin{cases} 1, & \text{if } t \in f(I_{n}^{(k)}), \\ 0, & \text{otherwise.} \end{cases} $$ Note that $t \mapsto L_{n}^{(k)}(t)$ is measurable because it has at most two points of discontinuity, therefore the function $$ N_k(t) = L_{1}^{(k)}(t) + \cdots + L_{2^k}^{(k)}(t) $$ is also measurable. Note that $N_k(t)$ simply counts on how many of the intervals $I_{1}^{(k)},\ldots,I_{2^k}^{(k)}$ the function $f$ attains the value $t$ at least once. Thus, the sequence $(N_k)_{k=1}^\infty$ of measurable functions is increasing and therefore the pointwise limit $$ \widetilde{N}(t) = \lim_{k\to\infty} N_k(t) $$ exists and is a measurable function of $t$. Observe that by definition $N(t) \geq N_k(t)$ for all $k$, so $N(t) \geq \widetilde{N}(t)$. Let us argue that $\widetilde{N}(t) \geq N(t)$. Let $m$ be an integer such that $N(t) \geq m$. Then there exist points $a \leq x_1 \lt \cdots \lt x_m \leq b$ such that $f(x_i) = t$. If $k$ is so large that $\frac{b-a}{2^k} \lt \min{\{x_{i+1} - x_i\,:\,i=1,\dots,m-1\}}$ then $N_k(t) \geq m$. This shows $\widetilde{N}(t) \geq N(t)$ and thus $\widetilde{N}(t) = N(t)$, establishing measurability.

Note: Since $L_{n}^{(k)}$ only has no more than two discontinuities, it is at most of first Baire class, hence so are the $N_k$ and thus their pointwise limit $N$ is of Baire class at most two.

b) Let $f$ be a continuous function. Then $N$ is integrable if and only if $f$ is of bounded variation and in that case $\operatorname{Var}_{a}^b(f) = \int N$.

Keep the notations of part a). Let $M_{n}^{(k)} = \sup_{x \in I_{n}^{(k)}} f(x)$ and $m_{n}^{(k)} = \inf_{x \in I_{n}^{(k)}} f(x)$. Notice that $\int L_{n}^{(k)} = M_{n}^{(k)} - m_{n}^{(k)}$ so that $\int N_k = \sum_{n=1}^{2^k} M_{n}^{(k)} - m_{n}^{(k)}$. If $f$ is of bounded variation then this last sum is bounded above by $\operatorname{Var}_{a}^b(f)$ so that the monotone convergence theorem implies that $$ \int N = \lim_{k \to \infty} \int N_k \leq \operatorname{Var}_{a}^b(f). $$ On the other hand, if $f$ is continuous (of bounded variation or not), it is not hard to show that for every $c \lt \operatorname{Var}_{a}^b(f)$ there is $\delta \gt 0$ such that for all partitions $a = a_0 \lt a_1 \lt \cdots \lt a_n = b$ with $a_{m} - a_{m-1} \lt \delta$ we have $\sum_{m=1}^n \lvert f(a_{m}) - f(a_{m-1})\rvert \geq c$. Thus, we have for $k$ sufficiently large that $\sum_{n=1}^{2^k} M_{n}^{(k)} - m_{n}^{(k)} \geq c$ and from this we conclude that $\int N \geq \operatorname{Var}_{a}^b(f)$ if the latter is finite.

Conversely, suppose that $N$ is integrable. Since $N \geq N_k$ we have that $\sum_{n=1}^{2^k} M_{n}^{(k)} - m_{n}^{(k)} = \int N_k \leq \int N \lt \infty$ for all $k$, and this implies that $\operatorname{Var}_{a}^b(f) \leq \int N$, as we wanted.

c) If $f$ is continuous and of bounded variation then $N(t) \lt \infty$ almost everywhere.

This is clear, as $\int N = \operatorname{Var}_{a}^b(f) \lt \infty$ implies that $N$ can be infinite only on a set of measure zero.


Added: See also this related question where the accepted answer mentions a paper containing necessary and sufficient conditions for a measurable function $N: \mathbb{R} \to \mathbb{N} \cup \{\aleph_0, \mathfrak{c}\}$ to be the Banach indicatrix of a continuous function $f: [a,b] \to \mathbb{R}$.