Let $a = \frac{\pi}{2008}$. Find the smallest positive integer $n$ such that
\[\sum_{k = 1}^n 2 \cos (k^2 a) \sin (ka)\]is an integer.

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