5. Let the three-digit number $n=\overline{a b c}$, if the lengths of the sides $a, b, c$ can form an isosceles (including equilateral) triangle, then the number of such three-digit numbers $n$ is
A. 45
B. 81
C. 165
D. 216
Let's assume $2a = 2b > c$, then when $a = b = 1$, $c = 1$. The corresponding three-digit numbers are 1; when $a = b = 2$, $c = 1, 2, 3$. The corresponding three-digit numbers are 3; when $a = b = 3$, $c = 1, 2, 3, 4, 5$. The corresponding three-digit numbers are 5; when $a = b = 4$, $c = 1, 2, 3, 4, 5, 6, 7$. The corresponding three-digit numbers are 7; when $a = b = 5, 6, 7, 8, 9$, $c = 1, 2, \cdots, 9$. The corresponding three-digit numbers are 45. Among these, there are 9 equilateral triangles, so the isosceles (non-equilateral) triangles are $61 - 9 = 52$. Considering the permutations of $a, b, c$, the three-digit numbers that satisfy the condition are $52 \times 3 + 9 = 165$. Therefore, the answer is $C$.