I have been wondering (though I am not asking in this post) whether
a function $f:\mathbb{R}\to\mathbb{R}$ is locally constant almost everywhere $\iff$$\text{im}(f)$ is countable.
where by "locally constant at $x$" I mean that there is a neighborhood $N$ of $x$ so that $f$ is constant in $N$.
Because the discontinuitites of $f$ may be dense, I'm struggling to (dis)prove either direction, but I did get to ponder about the relation between the sets$$D := \{x: f\text{ is locally constant at }x\} \ \ \ \ \text{ and } \ \ \ \ \text{im}(f).$$Is the size of either $D$ or $\text{im}(f)$ bounded by the size of the other?