Solution:
If n=∏i=1kpirk is the canonical factorization of n, then φ(n)=∏i=1kpirk−1(pi−1) holds, so since n has no prime factors other than two, it must be that ai=1 and pi−1=2bi for every i and some bi. Since 2bi+1 can be prime only if bi is a power of two, we have pi=22ci+1 for some distinct ci.
Suppose that n+1 is not a power of two. From the fact that φ(n+1) is a power of two we obtain that all odd prime divisors of n+1 are of the form 22di+1. Therefore,
n=i=1∏k(22ci+1),n+1=2tj=1∏l(22dj+1)
where all ci and dj are mutually distinct. We may assume without loss of generality that c1<⋯<ck and d1<⋯<dl.
For every m,M∈N,m≤M, by simple induction one shows that
22m22m+1<i=m∏M22i22i+1=22m−122m⋅22M+122M+1−1<22m−122m
From this we obtain
22c122c1+12c⩽n<22c1−122c12cand22d122d1+12d⩽n+1<22d1−122d12d
where c=∑i2ci and d=t+∑j2di. It follows that c=d. If d1>c1, then 22d1−122d1<22c122c1+1 holds, so n+1<n, a contradiction. Therefore, d1<c1, and then n+1⩾22d122d1+12c>22c1−122c12c>n, so nn+1>22d122d1+1⋅22c122c1−1 and, because of n⩾22c1+1⩾a2+1 for 22d1=a,nn+1>a3(a+1)(a2−1)=1+a3a2−a−1, from which we conclude a2+1⩽n<a2−a−1a3. The only possibility is a=2 and n=5.