24. Use red, yellow, and blue to color a $1 \times n$ chessboard, with each square being one color. Find the number of coloring methods such that an odd number of squares are colored red.
24. $\frac{3^{n}-1}{2}$.