I was thinking about the doubt that if $M$ and $N$ are closed manifold and if there exists two Morse function $f$ and $g$ respectively on $M$ and $N$ with the following property that they both have same number of $i$ index critical points for each $i\in \mathbb N$, then whether I can conclude they are homeomorphic or not.

It is clear that they are of same dimension since the maximum of $f$ and $g$ are of same index. And we know that if a closed manifold has exactly two critical points then it is homeomorphic with $S^n$.

But still I don't expect an positive answer for my doubt. So to find a contradiction I was thinking about handle decomposition of some closed manifold. And now I got stuck with this doubt that suppose I have a handle decomposition of a closed manifold $X$, then can I construct a Morse function $f$ on $X$ such that corresponding to this Morse function I get the same handle representation?? This is kind of converse of Morse handle presentation theorem. So far I could not able to construct such a function.

And also I could not able to find any counter example for my initial doubts.

It'll be very helpful if someone clarify my these two doubts.