Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
By the way, I initially formulated the statement in a weaker form - "there exist at least $n/2+1$ critical points"; in this variant we may assume a finite number of critical points of $f$ and all level curves are "nice". Now I realize that my elementary proof works in fact without problems for this variant, so I'll may be go back to it.
The rotation number along the boundary is $n/2$, right. But the fact that "the index of ∇f is +1 at each extremum and negative at other critical points" needs a proof. On the other hand, I wish to avoid concepts like "index" and "rotation number". Anyway, if your arguments are correct, I will accept that the statement is "obvious" :)
@ Pietro Majer: This is supposed to be a counter-example, right? But I don't think that it satisfies the boundary conditions, seems to me that even each local extremum of $\varphi$ is a local extremum of $f$ as well.
@ Alex Degtyarev: I don't think that "there may be just a single extremum unside" - if $P$ and $Q$ are an absolute minimum and an absolute maximum of the restriction, then the conditions guarantee at least 2 absolute extrema of $f$ inside $D$ - a minimum and a maximum.