Okay, let's go through this step-by-step:
* There were more than 24 glasses, but less than 100 glasses
* If the glasses were in rows of 6, there would be 3 left over
* So we can try numbers from 25 to 99 glasses
* If we try 27 glasses (4 rows of 6 + 3 left over) that works
* If the glasses were in rows of 8, there would be 7 left over
* Trying 27 glasses does NOT work, because if we divide 27 by 8 we get 3 rows with 5 left over, not 7
* So we need to find a number of glasses where if divided by 8 has a remainder of 7
* The next number after 27 that works is 35
* 35 / 8 = 4 rows with 7 left over
Therefore, the number of glasses that were broken is 35. Half of that is 17 or 18 glasses that need to be replaced.