I'm trying to solve an exercise of Lebesgue Integral. It has to do with the following function $f : [0,\infty) \rightarrow \mathbb{R}$
$$ f(x) = \left\{ \begin{array}{ll} 0 & \quad x \in \mathbb{Q} \\ \frac{1}{2^{[x]}} & \quad x \not\in \mathbb{Q} \end{array} \right. $$
where $[x]$ is the integer part of $ x \in \mathbb{R} $. The exercise ask for:
i) Show that $f$ is Lebesgue measurable
ii) Calculate $$\int_{[0,\infty)}f$$
First I tried to graph the function $f$ 
Is that correct? if so I think I can do i) by cases on the paraeter $\alpha \in \mathbb{R} $
But how to do ii) ? Intuitively must be 2... some help to write it down.
Take some $\alpha\in\mathbb{R}$ and consider the set $E_{\alpha}=\{x : f(x)\gt \alpha\}.$ In order to show the measurability of $f,$ we have to prove that $E_{\alpha}$ is measurable for all $\alpha\in\mathbb{R}.$ Clearly
$$E_{\alpha}= \begin{cases} \emptyset, & \text{if $\alpha\ge1$} \\[2ex] \mathbb{R}\setminus\mathbb{Q}, & \text{if $\alpha=0$}\\[2ex] \mathbb{R}, & \text{if $\alpha\lt0$}. \end{cases}$$
Now take some $0\lt\alpha\lt 1,$ then there is a unique $n\in\mathbb{N}=\{0,1,2,\cdots\}$ such that $$\dfrac{1}{2^{n+1}}\le\alpha\lt\dfrac{1}{2^{n}}$$ and hence $E_{\alpha}=\{x : f(x)\gt \alpha\}=\{x\in\mathbb{R}\setminus\mathbb{Q}:0\lt x\lt n\}=(0,n)\setminus\mathbb{Q}$ which is measurable.
For the second part observe that $$\int_{[0,\infty)}f=\sum_{n\in\mathbb{N}}\left(\int_{[n,n+1)\cap\mathbb{Q}}f+\int_{[n,n+1)\setminus\mathbb{Q}}f\right)$$ and use the fact that rationals are measure zero.