Let $a_{1}, a_{2}, \cdots, a_{n}$ be all the irreducible proper fractions with a denominator of 60, then $\sum_{i=1}^{n}\left(\cos \frac{a_{1} \pi}{2}\right)^{2}$ equals ( )
(A) 0
(B) 8
(C) 16
(D) 30
4. (B).

Since for any $a_{1} \in\left\{a_{1}, \cdots, a_{n}\right\}$, we have $1 \cdots a_{1} \in\left\{a_{1}, \cdots, a_{n}\right\}$, thus $\sum_{1=1}^{n}\left(\cos \frac{a_{1} \pi}{2}\right)^{2}-$ $\sum_{i=1}^{n}\left(\cos \frac{\left(1-a_{i}\right) \pi}{2}\right)^{2}=\sum_{i}^{\pi}\left(\sin \frac{a_{i} \pi}{2}\right)^{2}$. Therefore, we have $2 \sum_{i=1}^{n}\left(\cos \frac{a_{2} \pi}{2}\right)^{2}=\sum_{i=1}^{n}\left(\left(\cos \frac{a_{i} \pi}{2}\right)^{2}+\right.$ $\left.\left(\sin \frac{a_{1} \pi}{2}\right)^{2}\right)=n$, and the number of integers $n=\varphi(60)=60\left(1-\frac{1}{2}\right)$. $\left(1-\frac{1}{3}\right)\left(1-\frac{1}{5}\right)=16$. Hence $\sum_{j=1}^{n}\left(\cos \frac{a_{1} \pi}{2}\right)^{2}=8$.