For which continuous functions $f:\mathbb R\to\mathbb R$ does there exist a discontinuous function $g$ such that $f=g\circ g$? Inspired by a bad approach to a homework problem, I'm wondering for which which continuous functions $f:\mathbb R\to\mathbb R$ does there exist a discontinuous function $g$ such that $f=g\circ g$.
Maybe I'm missing something immediate, but I'd like to show that there exists no continuous functions $f$ satisfying this.
Just kidding, it's apparently immediate.

Take the dirichlet's function:
g:$\mathbb{R} \rightarrow \mathbb{R}$
g($x$)=0 ; $x\in \mathbb{Q}$
g($x$)=1 ; $x\in \mathbb{R}- \mathbb{Q}$ 
Then f=g$\circ$g is the zero function.
