Continuous function/R to R/Finitely many values/Constant/Exercise

Let

be a continuous function which takes only finitely many values. Prove that is constant.