Problem

Source: Kyiv City MO 2021 Round 1, Problem 11.1

Tags: algebra



$N$ cossacks split into $3$ groups to discuss various issues with their friends. Cossack Taras moved from the first group to the second, cossack Andriy moved from the second to the third, and cossack Ostap - from the third group to the first. It turned out that the average height of the cossacks in the first group decreased by $8$ cm, while in the second and third groups it increased by $5$ cm and $8$ cm, respectively. What is $N$, if it is known that there were $9$ cossacks in the first group?