4.1. (12 points) In trapezoid $A B C D$ with bases $A D=17$ and $B C=9$, points $E$ and $F$ are marked on the bases respectively such that $M E N F$ is a rectangle, where $M$ and $N$ are the midpoints of the diagonals of the trapezoid. Find the length of segment $E F$.
Answer: 4.

Solution. The segment connecting the midpoints of the diagonals of a trapezoid is equal to half the difference of the bases, so $M N=\frac{A D-B C}{2}=4$. Since $M E N F$ is a rectangle, its diagonals are equal. Therefore, $E F=M N=4$.