1. Write 2004 numbers on the blackboard: $1,2, \cdots, 2004$, in each step, erase some numbers from the blackboard, and rewrite the remainder of their sum divided by 167. After several steps, two numbers remain on the blackboard, one of which is 999. What is the second remaining number?
1. Let the second number remaining on the board be $x$. Since $999>167$, 999 is not a number that is rewritten on the board after the operation, thus $0 \leqslant x \leqslant 166$.
Notice that, each operation does not change the remainder of the sum of all numbers on the board when divided by 167.
$$
1+2+\cdots+2004=\frac{2004 \times 2005}{2}=1002 \times 2005 .
$$

Since $167 \mid 1002$, it follows that $x+999=0(\bmod 167) \Rightarrow x \equiv 3(\bmod 167)$.
Also, $0 \leqslant x \leqslant 166$, so $x=3$.
Therefore, the second number remaining on the board is 3.