3-5. The distance from \(A\) to \(B\) is 999 km. Along the road, there are kilometer markers indicating the distances to \(A\) and to \(B: 0\) ।999, 1 ।998, \(\ldots, 999\) ।0. How many of these markers have only two different digits?
Solve 5. Answer: 40.

Assume that on the kilometer post, the number \(\overline{a b d a_{1} b_{1} c_{1}}\) is written. Then \(\overline{a b c} + \overline{a_{1} b_{1} c_{1}} = 999\), so \(a_{1} = 9 - a\), \(b_{1} = 9 - b\), and \(c_{1} = 9 - c\). If \(a = b = c\), then the required condition is satisfied. There will be exactly 10 such posts. Now, let's assume that among the digits \(a, b, c\) there are exactly two different digits. Among the digits \(a_{1}, b_{1}, c_{1}\) there will be exactly the same two digits if and only if these two digits sum to 9. There are exactly 5 such pairs of digits: \((0,9), (1,8), (2,7), (3,6)\), and \((4,5)\). There are exactly six three-digit numbers that can be written using two given digits: three of them are written with two digits \(a\) and one digit \(b\) (which stands in one of three positions), and the other three are written with one digit \(a\) and two digits \(b\). This gives us another \(5 \cdot 6 = 30\) posts, making a total of \(10 + 30 = 40\) posts.

\section*{8th Grade}