4. (2005 Croatian Mathematical Olympiad) Find all positive integers $n$ such that $2^{4}+2^{7}+2^{n}$ is a perfect square.
4. Notice that
$$
2^{4}+2^{7}=144=12^{2} \text {. }
$$

Let $144+2^{n}=m^{2}$, where $m$ is a positive integer, then
$$
2^{n}=m^{2}-144=(m-12)(m+12) \text {. }
$$

Each factor on the right side of the equation must be a power of 2. Set
$$
\begin{array}{l}
m+12=2^{p}, \\
m-12=2^{q},
\end{array}
$$

where $p, q \in \mathbf{N}, p+q=n, p>q$.
(1) - (2) gives
$$
2^{q}\left(2^{p-q}-1\right)=2^{3} \times 3 \text {. }
$$

Since $2^{p-q}-1$ is an odd number and $2^{q}$ is a power of 2, the equation has only one solution, which is $q=3, p-q=2$.
Therefore, $p=5, q=3$.
Thus, $n=p+q=8$ is the only positive integer that makes the given expression a perfect square.