Show that the only solution to $\phi(n) =n-2$ is $n=4$ Came across this question in Number Theory.

Let $\phi$ denote Euler's totient function;  Show that the only
  solution to $\phi(n) =n-2$ is $n=4$

My workings so far have included, firstly proving that $4$ is indeed a solution, I have also noted that the solution cannot be prime because $\phi(p)=p-1$.  
From here, could I note that my solution must be composite, and the only way in which it could have only 2 numbers which are not coprime would be if n is a square number?
Not sure how to prove this completely though.
Also, could I incorporate the fact that  $\phi(p^k)=p^{k-1}(p-1)$ in any way? 
All help greatly appreciated. Thanks.
 A: The equation $\phi(n) = n - 2$ means that there are $n - 2$ numbers in $\{1, 2, \dots, n\}$ that are relatively prime to $n$. In other words, there are exactly two numbers in $\{1, 2, \dots, n\}$ that are not relatively prime to $n$. One of them of course is $n$ itself. So there is exactly one other number, in $\{2, \dots, n-1\}$, which shares any factors in common with $n$.
Now as you observed, $n$ cannot be prime (because then there would be none). So $n$ is composite, and therefore has some prime factor $p$. This is one number with which $n$ shares a common factor, and if $n > 2p$, then $2p$ is another such number. So $n = 2p$. We now know that $n$ is even, i.e., $2$ is a prime factor $p$ of $n$, and from $n = 2p$, we get $n = 2\times2 = 4$.
A: Hint: We know that $(n,n-1)=1$ and $(1,n)=1$.  For $n >4$, can you use primes to come up with a further coprime integer less than $n$?
A: $\varphi(n)$ is even for every $n \ge 3$, so you would need $n$ to be even as well. However, if you write $n = 2^k m$, $m$ odd, then $$ n - 2 = \varphi(n) = \varphi(2^k) \varphi(m) = 2^{k-1} \varphi(m) \le 2^{k-1} m = \frac{n}{2}$$ which severely limits the possibilities for $n$.
