The director of a certain school decided to take a photo of the 2008 graduates. He arranged the students in parallel rows, all with the same number of students, but this arrangement was too wide for the camera's field of view. To solve this problem, the director decided to remove one student from each row, placing them in a new row. This arrangement did not please the director because the new row had four students fewer than the others. He then decided to remove one more student from each original row, placing them in the newly created row, and found that now all the rows had the same number of students, and he finally took his photo. How many students appeared in the photo?
The diagrams below represent the situation of the problem, where the students who were initially removed are represented in black and the students removed the second time, in gray.
![](https://cdn.mathpix.com/cropped/2024_05_01_280b19a87fa67143351eg-099.jpg?height=260&width=1538&top_left_y=2460&top_left_x=292)

Let $m$ and $n$ be the number of rows (horizontal lines) and columns of the initial formation, respectively. By taking one student from each of the $m$ rows, a new incomplete row is formed: four students are missing to complete the current $n-1$ columns, i.e., $m+4=n-1$ and therefore, $n=m+5$. Now we have $m$ rows of $n-1$ students, plus one incomplete row, where four students are missing.

By taking one student from each of the $m$ complete rows, we form a rectangle with one column less, thus filling the current three vacancies in the new row. Therefore, $m=3$ and thus, $n=8$. The total number of students in the photo is given by $n \times m=3 \times 8=24$.

![](https://cdn.mathpix.com/cropped/2024_05_01_280b19a87fa67143351eg-100.jpg?height=233&width=322&top_left_y=546&top_left_x=1532)