Morse functions and connected sum My question is closely related to this post but it is slightly different.
Let $M_1$ and $M_2$ be two smooth closed $n$-manifolds such that there is a Morse function $f_i:M_i\rightarrow \mathbb R$ for $i=1,2$. Moreover suppose that $\mu_k(f_i)$ is the number of critical points of index $k$ of $f_i$ for $k=0,\ldots,n$.
If $X:=M_1\#M_2$ is the connected sum, I'd like to find a Morse function $F:X\rightarrow \mathbb R$ such that 
$$\mu_k(F)=\mu_k(f_1)+\mu_k(f_2)\quad\text{for}\; k=1,\ldots, n-1$$
(note the range of the index $k$ from $1$ to $n-1$)
Pay attention: I don't want necessarily the critical points of $F$ to be the union on the critical points of $f_1$ and $f_2$. 
How can I construct such $F$?

Edit: I understand that I need to glue $M_1$ and $M_2$ near a maximum and a minimum, but then I don't know how to construct $F$.
When $f_1$ and $f_2$ are heights in $\mathbb R^n$ the geometric picture is clear, but I don't know how to deal with the general case.
 A: Let $D_i\subseteq M_i$ be small, open discs around the maximum / minimum respectively.
Then we can write the connected sum as
$M_1 + M_2 = (M_1\setminus D_1) \sqcup_{\partial D_1=S^{n-1}\times\{1\}} (S^{n-1}\times [1,2]) \sqcup_{S^{n-1}\times\{2\} = \partial D_2} (M_2\setminus D_2)$
Now this works for all small discs around those points. But we know that there are discs on which $f_i$ is just the function $x\mapsto f(0) +\|x\|^2$ (or $x\mapsto f(0)-\|x\|$ respectively). In particular: $f_i$ is constant on $\partial D_i$. This means that we can glue together $f_1$ and $f_2$ by defining a smooth function $S^{n-1}\times[1,2] \to \mathbb{R}$ that only depends on the second parameter, not on the $S^{n-1}$ parameter, and extends $f_1$ (defined on a neigbourhood of $S^{n-1}\times\{1\}$) and $f_2$ (defined on a neighbourhood of $S^{n-1}\times\{2\}$).
This connecting function can be choosen to be monotonically increasing (w.r.t. the $[1,2]$-parameter) from the maximum of $f_1$ to the minimum of $f_2$ so that the composite $F$ does not have any critical points in the connecting cylinder.
