Let $0 < \theta < 2\pi$ be a real number for which $\cos (\theta) + \cos (2\theta) + \cos (3\theta) + \cdots + \cos (2020\theta) = 0$ and $\theta =\frac{\pi}{n}$ for some positive integer $n$. Compute the sum of the possible values of $n \leq 2020$.

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