4. In a regular 2017-gon, all diagonals are drawn. Petya randomly selects some $\mathrm{N}$ diagonals. What is the smallest $N$ such that among the selected diagonals, there are guaranteed to be two of the same length?
Answer: 1008.

Solution: Let's choose an arbitrary vertex and consider all the diagonals emanating from it. There are 2014 of them, and by length, they are divided into 1007 pairs. Clearly, by rotating the polygon, any of its diagonals can be aligned with one of these. Therefore, there are only 1007 different sizes of diagonals. Thus, by choosing 1008, Petya is guaranteed to get at least two of the same.