The $n$-th roots of unity $\omega^{(k)}_n$ are
\begin{equation}
\omega^{(k)}_n = \exp\left(2\pi i k\over n\right) \mathrm{~for~} k=0,1,\ldots, n-1~.
\end{equation}
As some examples, for $n=2$, we have the roots $\omega^{(0)}_2=1$ and $\omega^{(1)}_2=-1$. Now, note for $n=4$, we have $\omega^{(2)}_4=-1$. There is a root in common here because $1/2 = 2/4$, i.e. the ration of $k/n$ is the same for these two roots (actually there is another common root, since $\omega^{(0)}_n = 1$ for all $n$). In fact, its clear from the formula for the $\omega$ that
\begin{equation}
\omega^{(k)}_{n} = \omega^{(l)}_m
\end{equation}
whenever ${k\over n} = {l \over m}$. So, given $n=72$ and $m=40$, you just have to figure out how many ways you can satisfy this relationship with integers $0 \le k < n$ and $0\le l < m$. Hopefully that's enough to get you started.