Let number of rows is x and number of students is y in a row.
Then total number of students = xy
A/C to question,
(x - 2)(y + 1) = xy
⇒xy + x - 2y - 2 = xy
⇒x - 2y = 2 -------(1)
Again, (x + 3)(y - 1) = xy
⇒xy - x + 3y - 3= xy
⇒ -x + 3y = 3 -------(1)
Solve equations (1) and (2),
y = 5 and put it equation (1)
x = 12
Hence, total number of students = xy = 12 × 5 = 60