PUMaC 2021 Number Theory B Problem 8

Let f(n) = \sum_{i=1}^{n} \frac{\gcd(i,n)}{n}. Find the sum of all positive integers n for which f(n) = 6.