The number of nodes of a perfect binary tree with heigh $h$ is
$$n = 2^{h+1} - 1$$The important property of perefect bnary tree is that always $\lfloor \frac{n}{2} \rfloor + 1$ of nodes are leaves.
The height ($h$) of a perefect tree with $n$ nodes can be computed as
$$h = \lg(n+1) - 1$$
In [ ]: