Think of the area of the boxes as representing the total height of a group.
The top left box is the total for the boys (however many there are).
The green box at the bottom is for that one girl who is 137 cm tall.
The box dotted-line box is the new total for the boys and girl.
This means the extra tail bit from the girl should be added to the missing piece to complete the total. Since both must have an area of 12, it should be easy to figure out that there are 6 boys.
This can be a difficult method to grasp just by looking at it once though…