4. $N$ children met. Some of them gave gifts to some others (one could not give more than one gift to another). It turned out that everyone received an equal number of gifts, although they all gave different numbers of gifts (including possibly someone giving no gifts at all). For which $N>1$ is this possible?
Solution. Everyone gave a different number of candies, and no one gave candies to themselves, so all quantities from 0 to $N-1$ were given. Therefore, the total number of candies given is $\begin{gathered}N(N-1) \\ 2\end{gathered}$, and this number must be divisible by $N$. This is only possible for odd $N \stackrel{2}{\text { (for }}$ even $N$ there will be a remainder $\frac{N}{2}$ ).

For an example with odd $N$, we will construct it by induction. If $N=1$, then no one gives anything. Otherwise, let the last child give one candy to everyone else, and all children from the second to the $(N-1)$-th give one candy to the first and the last (since $N$ is odd, this can be done so that in the end the first and the last receive the required number of candies). Now, for children from the second to the $(N-1)$-th, we can apply the induction hypothesis.