Paint three faces of an $8 \times 8 \times 8$ cube red and three faces blue (requiring that any three faces sharing a common vertex cannot all be the same color), then cut it into 512 $1 \times 1 \times 1$ small cubes. Among these 512 small cubes, there are $\qquad$ small cubes that have both red and blue faces.
According to the problem, any three faces sharing a common vertex cannot all be painted the same color;
Therefore, let's assume the top, bottom, and front faces are painted red, and the left, right, and back faces are painted blue;
That is, in the cube $A B C D-E F G H$, the faces $E F G H$, $A B C D$, and $A B F E$ are painted red, and the faces $A D H E$, $B C G F$, and $D C G H$ are painted blue; thus, the small cubes on the common edges of the red and blue faces will have both red and blue faces;
That is, the small cubes on the 8 edges $C D$, $G H$, $A E$, $B F$, $A D$, $B C$, $F G$, and $E H$ will have both red and blue faces; note that each small cube at the vertices is counted twice, i.e., it is overcounted by 1; hence, there are $8 \times 8-8=56$ small cubes that have both red and blue faces.