For a natural number $n$, define the function $f ( x )$ as
$$f ( x ) = \begin{cases} \left| 3 ^ { x + 2 } - n \right| & ( x < 0 ) \\ \left| \log _ { 2 } ( x + 4 ) - n \right| & ( x \geq 0 ) \end{cases}$$
Let $g ( t )$ be the number of distinct real roots of the equation $f ( x ) = t$ for a real number $t$. Find the sum of all natural numbers $n$ such that the maximum value of the function $g ( t )$ is 4. [4 points]