The question states that the number of students with at least

questions wrong is

. Hence the number that actually get exactly

wrong,

, must be the number that get at least

wrong minus those that get at least
)
wrong. So we have

.
So if we let

be the total number of wrongly answered questions then

,
)
,

,
 4^{n-(k+1)} + <br />
\sum_{k=1}^{n-1} 4^{n-(k+1)})
,
} )
(letting

),
} )
,
} )
,
} )
,

(letting
)
),
)
.
(I know I could have explicitly written out the sum, 'spot the pattern' - as I did on paper, but decided this was typographically easier than using an array).
So we have that
and solving gives us that
![\color[rgb]{0,0,1} \boxed{n = 5}](http://latex.codecogs.com/png.latex?\color[rgb]{0,0,1} \boxed{n = 5})
.