The distance between towns A and B is 999 km. At every kilometer of the road that connects A and B a sign shows the distances to A and B as follows:
$$\boxed{0|999}\quad\boxed{1|998}\quad\boxed{2|997}\quad\ldots\quad\boxed{998|1}\quad\boxed{999|0}$$
How many signs are there, with both distances written with the help of only two distinct digits?

Let's think step by step and output the final answer within \boxed{}.
user