Example 4 Given that among the 48 square faces of 8 unit cubes, any $n$ are painted black, and the rest are painted white. It is always possible to construct a larger cube using the 8 unit cubes such that the 24 unit squares on its surface are equally divided into black and white squares. Find all possible values of $n$.
(1992 Tianjin Team Test)
First, we color 8 unit cubes as follows: the first 5 cubes have 2 white faces and 4 black faces with the two white faces opposite each other; the 6th cube is painted with 2 black faces and 4 white faces with the two black faces opposite each other; the last two cubes are painted entirely white. At this point, among the 48 surface squares of the 8 cubes, there are 22 black and 26 white squares. Since in the above coloring method, black faces are opposite black faces and white faces are opposite white faces, no matter how the large cube is constructed, there will always be exactly 11 black squares and 13 white squares on its surface, which means it is impossible to meet the requirement, thus \( n \geqslant 23 \). Similarly, it can be proven that \( n \leqslant 25 \) (just by changing the black to white and white to black in the above coloring method).

Next, we prove that when \( 23 \leqslant n \leqslant 25 \), it is always possible to construct a large cube that meets the requirement.
First, arrange 8 unit cubes in some way to form a large cube. Clearly, we only need to consider the cases where they meet the requirements of the problem. Let the number of black squares on the surface be \( m \), and assume \( m \leqslant 11 \) (if \( m \geqslant 13 \), then just swap the black and white colors).

Notice that when any unit cube is rotated \( 90^{\circ} \) around an axis passing through its center and perpendicular to a pair of opposite faces, the original surface unit square of the large cube will move to the inside, and the unit square opposite to this face will move from the inside to the surface. Therefore, each operation can change the value of \( m \) by \( +1, 0 \), or \(-1\). Since it is always possible to perform 3 operations on a unit cube (rotating \( 90^{\circ} \) around 3 different axes), making the 3 surface unit squares and the 3 internal unit squares of the cube swap positions, it is possible to use 24 rotations to swap 24 surface unit squares with internal ones. At this point, the number of black squares on the surface is \( m^{\prime} = n - m \geqslant 12 \). If \( m^{\prime} = 12 \), the problem is solved. Assume \( m^{\prime} \geqslant 13 \), and let the number of black squares on the surface after \( i \) rotations be \( m_{i} \). Thus, \( \left| m_{i+1} - m_{i} \right| \leqslant 1 \). Since \( m_{0} = m \leqslant 11 \) and \( m_{24} = m^{\prime} = n - m \geqslant 13 \), there must exist an \( i_{0} \left(1 \leqslant i_{0} \leqslant 23\right) \) such that \( m_{i_{0}} = 12 \). Therefore, after \( i_{0} \) rotations, the large cube obtained meets the requirement.
In summary, the possible values of \( n \) are \( 23, 24, 25 \).