Problem

Source: 2022 Peru MO (ONEM) L3 p1 - finals

Tags: combinatorics



The following figure is made up of $12$ segments and $8$ circles. As you can see, at the beginning all the circles are empty. In each operation an empty circle is chosen, it is painted red and inside it the number of red neighboring circles that the chosen circle has is written (in the first operation the chosen circle is painted red and the number $0$ is written). After $8$ operations all the circles are painted red and each one has a number written on it. Prove that, no matter how the operations are done, the sum of all the numbers at the end is the same.