Find the number of ways to arrange the numbers $ 0, 0, 0, 1, 1, 1, 2, 2, 2$ so that no arrangement ever contains three consecutive integers that are the same.

I have the solution but I don't understand it. Can you explain how its 7!/3!3! and how its 5!/3![![enter image description here](https://i.stack.imgur.com/7KbiT.png)][1](https://i.stack.imgur.com/7KbiT.png)