Consider the following problem (Exercise (5) at the end of Chapter 2 of *Curves and Surfaces*, 2nd Edition, by Montiel and Ros):

Take a compact surface $S$ and a differentiable function $f: S \longrightarrow \mathbb{R}$ defined on it. Estimate the number of connected components of $S$ in terms of the number of critical points of $f$.

My attempt of solution is as follows:

Since $S$ is compact, every connected componet is compact. Hence, in every connected component the function $f$ attains a local maximum and a local minimum. These points are critical points of $f$, by a proposition in the body of the text. Hence, if $n$ is the number of connected components and $c$ is the number of critical points, we have that $$ c \geq 2n \implies n \leq c/2. $$

Is there a way to improve this estimate?