A teacher on attempting to arrange the students for mass drill in the form of a solid square found that 24 students were left. When he increased the size of the square by one student, he found that he was short of 25 students. Find the number of students.