On an island, there are magical sheep. There are 22 blue ones, 18 red ones, and 15 green ones. When two sheep of different colors meet, they both turn into the last color. After a certain number of encounters, all the sheep have the same color. What is it?
Let's denote $R, V, B$ as the number of red, green, and blue sheep, respectively. We observe that $R-V \bmod 3$ is invariant. Indeed, if a red sheep meets a green sheep, then both $R$ and $V$ decrease by 1; and if a red sheep meets a blue sheep, $R$ decreases by 1 while $V$ increases by 2; the same reasoning applies if a green sheep meets a blue sheep. We also have, in the same way, that $V-B \bmod 3$ and $B-R \bmod 3$ are invariants of the problem. Suppose, by contradiction, that the final color is red. Then we have $R=55$ and $V=0$. But then $R-V \equiv 1 \pmod{3}$, which is not its initial value. Absurd. The same applies if the final color is green. Finally, the sought color is blue.