In Hildebrand's lecture notes on analytic number theory, I have that
$$\sum_{n\leq N} \log n = N(\log N -1) + 1/2\log N + c + O(1/N)$$
And notes directly jumps from here to this
$$n! = C\sqrt{n}n^ne^{-n}\left(1+O(1/n)\right)$$
I couldn't catch the reason of this jump. Taking exponent of first equality it should follow that (letting $C=e^c)$
$$n! = C\sqrt{n}n^ne^{-n}e^{O(1/n))}$$
But I cannot justify the jump here, is it something like that?
$$e^{O(1/n)} = C\sqrt{n}n^ne^{-n}O(1/n)$$
I'm really stuck here, any help would be appreciated.