4. A clock has three hands that all rotate at a uniform speed. The second hand makes a full circle in one minute, the minute hand in one hour, and the hour hand in 12 hours. At midnight, all the hands are in the same position. How many times in a 24-hour period from then will one hand coincide with each of the other two hands at an angle of $30^{\circ}$?
4. Let $t$ be the number of seconds that have passed since midnight, where $t$ is a non-negative real number. The angles through which the second, minute, and hour hands have moved, respectively, are $6t, \frac{t}{10}$, and $\frac{t}{120}$ (expressed in degrees). The condition that the second and minute hands form an angle of $30^\circ$ is $6t - \frac{t}{10} = \pm 30 + 360a$, which is equivalent to

$$
t = \frac{300(\pm 1 + 12a)}{59}
$$

The condition that the second and hour hands form an angle of $30^\circ$ is $6t - \frac{t}{120} = \pm 30 + 360b$, which is equivalent to

$$
t = \frac{3600(\pm 1 + 12b)}{719}
$$

The condition that the minute and hour hands form an angle of $30^\circ$ is $\frac{t}{10} - \frac{t}{120} = \pm 30 + 360c$, which is equivalent to

$$
t = \frac{3600(\pm 1 + 12c)}{11}
$$

(where $a, b$, and $c$ are some integers). According to the problem, two of these three equations must hold. Since the numbers 11, 59, and 719 are pairwise coprime, it follows that $t$ must be an integer (namely, the denominator of $t$ must divide two of these three numbers, so the denominator must be 1). Since one of the last two equations holds, and 3600 is coprime with both 11 and 719, it follows that $t$ is divisible by 3600. In other words, the conditions of the problem can only be satisfied when an integer number of hours have passed, which means that both the second and minute hands point to the number 12. Then, to satisfy the conditions of the problem, the hour hand must point to the number 1 or 11. It follows that during a 24-hour period, the conditions of the problem will be satisfied 4 times: at $1:00, 11:00, 13:00$, and 23:00.