Problem 4 (due on Monday, October 21).

Find all continuous functions $f:\mathbb R\longrightarrow \mathbb R$ such that for any real numbers $x,y$ either $f(x+f(y))=f(x)+y$ or $f(f(x)+y)=x+f(y)$.