Let $f:\mathbb{R} \to \mathbb{R}$ assume that for an arbitrary interval $(a,b) \subseteq \mathbb{R}$ inverse image $f^{-1}((a,b))$ is union (not necessarily finite) of open intervals. Show that function $f$ is continuous.
I'd be grateful for any hints, since I have problem with tackling this one