Correcting the set in my proof.

It's better to directly prove that $X=\{x\in [0,\pi/2]\mid \cos(x) \in\Bbb{Q}\}$ is countable.

There is a natural bijection between $X\to \Bbb{Q} \cap [0,1]$ given by $f(x) = \cos(x) $ since $\cos$ is injective (1 on 1) on $[0,\pi/2]$ then so it is on $X\subseteq [0,\pi/2]$.

Since $\cos x$ is surjective (onto) from $[0,\pi/2]$ to $[0,1]$ then for each element from $[0,1]\cap\Bbb{Q}$ there is a corresponding element $y\in [0,\pi/2]$ such that $\cos y=x$ but by definition $\cos y=x\in\Bbb{Q} $ so $y\in X$.


Expanding a little on my comment...We need to show that we can ignore the $\cos x \in \Bbb{Q}$ case and just integrate $\sin^2$. Moreover, this is true when integrating over any subset $J \subseteq \Bbb{R}$, not just $J = [0, \pi/2]$.

I claim that $X = \{x \in J: \cos x \in \Bbb{Q} \}$ is countable. If this is true, then $X$ has measure zero, and deleting that case in the definition of $f$ does not change the integral of $f$, as required.

We can assume $J = \Bbb{R}$ since this gives us the largest $X$. Note that for any $y \in \Bbb{R}$, if we define $C_y$ as $\{x \in \Bbb{R}: \cos x = y\}$, then $C_y$ is countable (look at the way horizontal lines meet the cosine graph). $X$ is just $\bigcup_{y \in \Bbb{Q}} C_y$, so it's a countable union of countable sets. So $X$ is countable, as required.