For example say, $n = 2$. So our set is $\{1, 2, 3, 4\}$ in base $10$ and $\{1, 10, 11, 100\}$ in base $2$. So Output $1$, because only one number i.e. $3$ is there such that it has $``11"$ in it.
For $n = 3$, we get $\{3, 6, 7\}$ as having $``11"$, so output $3$.