This is not the first crisis in the history of IGG. Whenever cost reduction
was needed in the past, firing employees worked to some degree. This affected
workers at the bottom of the food chain more often; managers could generally
evade the threat. Over the decades this caused an unusually large amount of
middle managers to accumulate. The CEO finally realized there's no other way to
balance the structure of the company but to make their positions redundant.
A middle manager is somebody who has subordinates (who might also be managers), but the CEO is not a middle manager. Everyone can have at most M subordinates. If someone is fired, their subordinates are reassigned to their boss. Determine at most how many middle managers can be fired, such that the "at most M subordinates" rule still holds?
10 4 0 3 6 2 3 2 1 9 2 1 8 2 1 1 4 0 1 0 0 2 7 4 4 0 1 1 5 1 0