Let the complex number $z = \cos\frac{1}{1000} + i \sin\frac{1}{1000}$. Find the smallest positive integer $n$ such that $z^n$ has an imaginary part that exceeds $\frac{1}{2}$.

Let's think step by step and output the final answer within \boxed{}.
user