Observe that the number of students that have give EXACTLY 1 wrong answer is
\( 2^{n-1}-2^{n-2}=2^{n-2} \),
which is the difference between the number of students giving at least 1 wrong answer and the number of students giving at least 2 wrong answers.
In general, the number of students that gave exactly \( i \) wrong answers for \( 1\leq i\leq n-1 \) is:
\( 2^{n-i}-2^{n-i-1}=2^{n-i-1} \),
while the number of students that gave exactly n wrong answers is \( 2^0=1 \) (because giving at least \( n \) wrong answers is the same as giving exactly \( n \) wrong answers)
Hence, adding a geometric series, we have that
\( 2047=2^{n-2}+2^{n-3}+\cdots+1=2^{n-1}-1 \)
so, \( 2^{n-1}=2048 \) and \( n=12 \).