Problem 5.2. At first, the magical island was divided into three counties: in the first county lived only elves, in the second - only dwarves, in the third - only centaurs.

- During the first year, each county where non-elves lived was divided into three counties.
- During the second year, each county where non-dwarves lived was divided into four counties.
- During the third year, each county where non-centaurs lived was divided into six counties.

How many counties were there on the magical island after all these events?
Answer: 54.

Solution. Initially, there was 1 county of each kind.

After the first year, there was 1 elven county, 3 dwarf counties, and 3 centaur counties.

After the second year, there were 4 elven counties, 3 dwarf counties, and 12 centaur counties.

After the third year, there were 24 elven counties, 18 dwarf counties, and 12 centaur counties. In total, $24+18+12=54$ counties.