9. Let $n$ be a positive integer not exceeding 2003. If there is an angle $\theta$ such that $(\sin \theta+\mathrm{i} \cos \theta)^{n}=\sin n \theta+\mathrm{i} \cos n \theta$ holds. Then the total number of such $n$ is $\qquad$.
9. 501 .
$$
\begin{array}{l}
(\sin \theta + i \cos \theta)^{n} = [i(\cos \theta - i \sin \theta)]^{n} \\
= i^{n}[\cos (-\theta) + i \sin (-\theta)]^{n} \\
= i^{n}(\cos n \theta - i \sin n \theta) = i^{n-1}(\sin n \theta + i \cos n \theta).
\end{array}
$$

If \( i^{n-1}(\sin n \theta + i \cos n \theta) = \sin n \theta + i \cos n \theta \), then \( i^{n-1} = 1 \). Therefore, \( n = 4k + 1 \leq 2003 \), where \( k \) (with \( k \geq 0 \)) is an integer.
Thus, the number of \( n \) that satisfy the condition is \(\left[\frac{2003-1}{4}\right]+1=501\).