Problem: $f$ is a function from $\mathbb{R}$ to $\mathbb{R}$, here $\mathbb{R}$ is the set of real numbers. $f$ cannot be continuous if $f$ takes every value exactly twice.
Now this question is really old and asked many times before on stackexchange. But every solution is by crude manipulation. I want to know if there exists an insightful solution of this.
My problem: I have solved the problem before like this, first assume the function is continuous and then by applying intermediate value property lead to some contradiction. But if the problem is a more general one, like if the function takes every value thrice, the same argument works, but the solution becomes lengthier. That's why I am asking for some more nice solution, may be using some advanced tools.