5. Let the three-digit number $n=\overline{a b c}$, if $a, b, c$ can form an isosceles (including equilateral) triangle, then the number of such three-digit numbers $n$ is ( ) .
A. 120
B. 240
C. 165
D. 480
5. C (1) If three digits $a, b, c$ form an equilateral triangle, then the number of three-digit numbers $n$ is $C_{9}^{1}=9$;
(2) If three digits $a, b, c$ form an isosceles (non-equilateral) triangle.
Assume $a, b$ are different digits, and $a>b$, then $b<a<2b$.
The number of pairs $(a, b)$ that do not satisfy the condition is 20:
$$
\begin{array}{l}
(9,4),(9,3),(9,2),(9,1),(8,4),(8,3),(8,2),(8,1),(7,3),(7,2),(7,1),(6,3), \\
(6,2),(6,1),(5,2),(5,1),(4,2),(4,1),(3,1),(2,1) .
\end{array}
$$

Then the number of three-digit numbers $n$ is $C_{3}^{2} \cdot\left(2 \cdot C_{9}^{2}-20\right)=156$.
In summary, the total number of three-digit numbers $n$ is $9+156=165$.