So I have the following task:
We have a rectangle $2 \times 4$ cells and four colors: red, green, blue, black. How many ways are there to paint each cell, so that no two cells with a common side were painted the same color.
How to solve this? I'm interested in the explanation first and some pattern for such tasks cause my teacher didn't explain me.