4. Determine all functions $f: \mathbb{N} \rightarrow \mathbb{N}$ such that for every $n \in \mathbb{N}$,

$$
2 n+2001 \leqslant f(f(n))+f(n) \leqslant 2 n+2002
$$

(Romania)
4. The function $f(n)=n+667$ satisfies the conditions of the problem.

For a given $n \in \mathbb{N}$, we define the sequence $(a_{k})$ with $a_{0}=n$ and $a_{k+1}=f(a_{k})$ for $k \geqslant 0$. If we denote $b_{k}=a_{k+1}-a_{k}-667-\frac{1}{6}$, by the condition of the problem, $-\frac{1}{2} \leqslant c_{k}=b_{k+1}+2 b_{k} \leqslant \frac{1}{2}$. Since

$$
\begin{aligned}
b_{m} & =(-2)^{m} b_{0}+\sum_{k=0}^{m-1}(-2)^{m-1-k} c_{k} \quad \text { and } \\
a_{n} & =a_{0}+667 n+\sum_{m=0}^{n-1} b_{m}=a_{0}+667 n+\sum_{m=0}^{n-1}(-2)^{m} b_{0}+\sum_{k=0}^{n-2} \sum_{m=k+1}^{n-1}(-2)^{m-1-k} c_{k} \\
& =a_{0}+667 n+\frac{1-(-2)^{n}}{3} b_{0}+\sum_{k=0}^{n-2} \frac{1-(-2)^{n-k-1}}{3} c_{k} \\
& \leqslant a_{0}+667 n+\frac{1-(-2)^{n}}{3}\left(b_{0}+\frac{(-1)^{n-1}}{2}\right)
\end{aligned}
$$

it must be true that $a_{n}\frac{1}{2}$. Since by the condition of the problem $a_{n}>0$ for all $n$, it follows that $-\frac{1}{2} \leqslant b_{0}=f(n)-n-667-\frac{1}{6} \leqslant \frac{1}{2}$, from which $f(n)=n+667$.