The behaviour of the composition of the polynom and a function I need to prove


  Suppose $f(x)$ is defined and continuous on $[0, 1]$ and it attains its the largest value at three points. Then $g(x) = f^3(x) - f^2(x) + 5 f(x) - 14$ attains its the largest value also at three points


$(f^3(x) - f^2(x) + 5f(x) - 14)' = f'(x) (3 f^2(x) - 2f(x) + 5) = 0 \iff f'(x) = 0$. 

Derivatives of functions attain zero at the same points, but can it be necessarily condition to say that $g(x)$ attains the greatest value at three points such as $f(x)$ ? I mean, that the function can haven't got a derivative at the extrema points, can it? $|x|$ for example. So, as I understand I can't use the equality of derivatives in order to prove the statement. 

Also, I've noticed that $g(x) = (f(x) - 2)(f^2(x) + f(x) + 7)$ but have no idea, how that fact can help me...

Could you please give me any hints, how to prove the statement?

Thanks in advance!
Note that, if $p(x)=x^3-x^2+5x-14$, then $g(x)=p\bigl(f(x)\bigr)$. On the other hand, $p$ is strictly increasing. Therefore, $p\circ f$ attains its largest value exactly at the points at which $f$ attains its largest value.
Assuming $f $ differentiable, The equation $$g'(x)=f'(x)(3f^2 (x)-2f (x)+5)=0$$

has only three roots ( those of $f'(x)=0$), since the discriminant of the second equation $3X^2-2X+5=0$ is

$2^2-60 &lt;0$.