The director of the 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 noticed that it was enough to remove one student from each row and place them in a new row. This arrangement did not please the director because the new row had 4 students fewer than the others. He then decided to remove one more student from each row and place them in the new row he created, and found that this way all the rows had the same number of students, and finally took the photo. How many students appeared in the photo?
The figures below represent the situation of the problem, where in black are represented the students who were initially removed and in gray the students removed for the second time.
![](https://cdn.mathpix.com/cropped/2024_05_01_eead07372ad548e635bag-22.jpg?height=270&width=1394&top_left_y=1622&top_left_x=339)

Let $n$ and $m$ be the number of rows (horizontal lines) and columns of the initial formation, respectively. By removing 1 student from each row, the director obtains a formation with one column less and an incomplete row - 4 students are missing. Therefore, we can conclude that:

$$
n+4=m-1 \quad \Rightarrow \quad m=n+5
$$

By now removing another student from each row, a rectangular formation is obtained with 2 columns less than the initial formation. Therefore, we can conclude that the number of rows (initial) is $n=3$. Thus, $m=8$ and the number of students is given by $n \times m=3 \times 8=24$.

![](https://cdn.mathpix.com/cropped/2024_05_01_eead07372ad548e635bag-22.jpg?height=276&width=409&top_left_y=2193&top_left_x=1324)