5. For what largest $p$ does there exist a convex $n$-gon in which the lengths of the diagonals take on no more than two distinct values? (I. Rubanov)
Answer. For $n=7$. Solution. Example. A regular heptagon. It has diagonals of exactly two types: connecting vertices one apart and two apart. Evaluation. Let $A B$ be a side of a convex polygon $M$, which has diagonals of only two possible lengths $x$ and $y$. Then for any vertex $C$, not adjacent to $A$ and $B$, the sides $C A$ and $C B$ of triangle $A C B$ can only equal $x$ and $y$. The choice of these side lengths uniquely determines the vertex $C$, as it must lie on the same side of the line $A B$ as the entire polygon $M$. However, there are only four such combinations of sides: $C A=C B=x ; C A=C B=y ; C A=x, C B=y$; $C A=y, C B=y$. Of these, only one of the first two combinations is possible: otherwise, the corresponding vertices $C_{1}$ and $C_{2}$ of the polygon $M$ would lie on the perpendicular bisector of the side $A B$, and the one closer to $A B$ would be inside the triangle with vertices at $A, B$, and the other of these vertices, which contradicts the convexity of $M$. Thus, the polygon $M$ has no more than three vertices not adjacent to vertices $A$ and $B$, meaning it has no more than 7 vertices.