12. 184

It is not difficult to prove that if the first digit of $9^{*}$ is 9, then $9^{k-1}$ and $9^{k}$ have the same number of digits, so the number of times the first digit is 9 in 7 is $4001-3817=184$.
12. Let \( \left.T=\left|9^{k}\right| k \in \mathbf{Z}, 0 \leqslant k \leqslant 4000\right\} \), given that \( 9^{4000} \) is a 3817-digit number. And its leading digit is 9, then in \( T \), there are \(\qquad\) numbers whose leading digit is 9.