2. Pavel took several matches and put them in the matchbox, then started making figures in the form of hexagons and octagons. The length of the side of each figure was equal to the length of one match. From all 168 matches, Pavel made exactly 23 figures. How many hexagons did Pavel make?
Solution. If all the figures are hexagons, then the number of matches used will be $23 \cdot 6=138$, i.e., Pavel will not use $168-138=30$ matches. When making an octagon, two more matches are used compared to making a hexagon. Therefore, the number of octagons is 30:2=15. Finally, Pavel made $23-15=8$ hexagons.