I'm trying to show that $$\sum_{d \mid p-1} T(d) = p-1,$$ where $p$ is prime and $T(d) = \# \{a \mid 1 \le a \le p - 1, \, (a,\,p-1)=d \}$.
I really don't even know how to begin on this problem. A hint would be appreciated.
This question is a subpart of a problem to prove that $\sum_{d \mid p-1} \varphi(d) = p-1$.