2. In the pop ensemble "Sunshine," everyone plays either the violin or the double bass. The average age of those who play the violin is 22 years, and those who play the double bass is 45 years. Igor changed his instrument and started playing the violin instead of the double bass. As a result, the average age of those who play the violin increased by 1 year, and the average age of those who play the double bass also increased by 1 year. How many people are in the ensemble "Sunshine"? Answer: 23.
Solution. Let $x$ be the number of people who play the contrabass, excluding Igor, and $y$ be the number of people who play the violin (also excluding Igor).

From the condition, it follows that the total age of those who play the contrabass was initially equal to: $(x+1) \cdot 45$, and when Igor changed the instrument, it became equal to $x \cdot 46$.

Then Igor's age is $(x+1) \cdot 45 - x \cdot 46 = 45 - x$.

Similarly, we get that Igor's age is $23 \cdot (y+1) - 22 \cdot y = y + 23$.

Then $45 - x = y + 23$, from which $x + y = 22$ is the number of pirates without Igor, and with Igor - 23.