TITLE: Continuous functions taking uncountably many values countably often
QUESTION [23 upvotes]: Let $f$ be a continuous function defined on the closed interval $[0,1]$. Clearly $f$ is bounded and attains its bounds. 
Then my question is how often can $f$ take a value in its range countably many times?
Formally let $Z(f,p)=\{x\in \text{Image}(f):|f^{-1}(x)| = p\}$. I would like to know large $Z(f,\aleph_0)$ can be?
I conjecture that we can find $f$ with $|Z(f,\aleph_0)|=2^{\aleph_0}$.
Note that I can find f with $Z(f,2^{\aleph_0}) = \aleph_0$ which I think makes the conjecture plausible:
We know that the zero set of a continuous function on $[0,1]$ can be any closed subset as we can take $f$ to be the distance to the closed set. If we let the closed set be the cantor ternary set $C$ on $[0,1]$ we can create a function on $[0,1]$ with uncountably infinite zero set. By taking suitable scalings of the function on intervals $[\frac{1}{2^{2n+1}}, \frac{1}{2^{2n}}]$ with ramps in between we can find a function $f$ s.t. $Z(f)$ is countably infinite. Hence we have $Z(f,2^{\aleph_0}) = \aleph_0$.

REPLY [10 votes]: Just to complement the answers that were already given, one can also have $|Z(f,2^{\aleph_0})|= 2^{\aleph_0}$: just take for $f$ a typical sample of Brownian motion. More precisely, almost every realisation of Brownian motion has the property that a set of $c$s of positive Lebesgue measure has a preimage of positive Hausdorff dimension. This can be shown by combining the fact that the zero level set of BM has positive Hausdorff dimension with Fubini and the strong Markov property.