Let E1 denote the event of selecting the coin with two heads,
and E2 denote the event of selecting a fair coin.
Then
P(E1)=1n+1, P(E2)=nn+1
Let A denote the event that the toss results in heads.
Then, by total probability theorem,
P(A)=P(E1)P(A|E1)+P(E2)P(A|E2)
⇒712=1n+1×1+nn+1×12⇒76=n+2n+1
⇒n=5