A college class originally had enough students to form eight equal rows, but when one student was absent they could form five equal rows, and when two students were absent they could form nine equal rows. The least possible number of students in the class is 40.