For $n$ heads, you start with $0$ heads and when you have $k$ heads, there is a 50:50 chance that you change to either $k+1$ heads or to $0$ heads.
For $n$ heads-or-tails, after one toss you definitely have $1$ head-or-tail, and when you have $k$ heads-or-tails, there is a 50:50 chance that you change to either $k+1$ heads-or-tails or to $1$ (other) head-or-tail.
Hence the answer to the second problem for $n$ is the same as the answer to the first problem with $n-1$, plus $1$.
Put differently, replace the original sequence of heads and tails by (the first toss and) XOR results of consecutive tosses (i.e., either $=$ or $\neq$). These occur like coin tosses, i.e., independently and with probability $\frac 12$. Your goal is to collect $n-1$ consecutive "$=$" (after the initial toss). So again, we arrive at $(2^{n-1}-2)+1$.