Problem 4. Each cell of a $3 \times 3$ table is painted in one of three colors such that cells sharing a side have different colors, and not all three colors need to be used. How many such colorings exist?