9 people in total.
divided into three shifts,
one shift: 1 people.
class two: 3 people.
class 3: 3 people.
that is, nine people, one person takes turns at a time, so you can take turns three times.
it can be arranged in this way. There are 3 classes *7 people *(31-9)=441 times.
21 days /9 people =2+3.
That is, one class: 9 people, one person for 2 days, and then three of them for 1 days.
class 2: 3*21/9=7 days.
that is, Class Two, with nine people working seven times each.
The same is true for Class Three, where nine people attend classes seven times each.
to put it simply, the number of times nine people go to Class One, Class Two and Class Three is 2 times, 7 times and 7 times.
then the number of times three of them worked an extra shift was zero.