Consider the function $f:[0,1] \rightarrow [0,\infty)$ that is defined as follows: $$f(x) = 0 \text{ if $x$ is rational and } 2^n \text{ when $x$ is irrational}$$ Here $n$ is the number of leading zeros in the decimal expansion of $x$ and it can take values $0, 1, ...$. Show that $f$ is measurable and calculate the value of the integral $\int_0^1 f$.
Any help would be appreciated, thanks