What I have tried so far: $n$ certainly can't be prime. It also can't be a power of prime as $\varphi(p^k)=p^k-p^{k-1})$ unless it is $25=5^2$. From here on, I am pretty stuck. I tried considering the prime factorization of $n$, or perhaps looking for some contradiction, which would show $n$ must be a power of a single prime, but cannot make progress: Let $n=p_1^{e_1}...p_k^{e_k}$. Then $$n(1-\frac 1{p_1})...(1-\frac 1{p_k})=p_1^{e_1}...p_k^{e_k}-5.$$ Do I need to consider modulo 5? I also thought about considering whether or not $5\mid n$ or whether $n$ is even/odd, but cannot seem to make progress.
I found this similar question asked on StackExchange a while ago, but since the RHS is $n-2$, they could consider restrictions with parity. I also don't get why they could assume that $n=pq$ is a product of exactly 2 distinct primes only for the contradiction.
Hint: Let $p$ be a prime dividing $n = \displaystyle\prod_{j}p_j^{e_j}$. Then, $$n-5 = \phi(n) = n\prod_{j}(1-\tfrac{1}{p_j}) \le n(1-\tfrac{1}{p}),$$ and thus, $1-\tfrac{5}{n} \le 1-\tfrac{1}{p}$, i.e., $\tfrac{n}{p} \le 5$.
Since $\tfrac{n}{p}$ must be an integer, we have $\tfrac{n}{p} \in \{1,2,3,4,5\}$. Hence, $n$ must be in the form $n = p, 2p, 3p, 4p, 5p$ for some prime $p$.
Can you try out each of these cases?