We would like to count the number of four-digit numbers such that the leftmost digit is nonzero in which at least two digits are the same.
We want to do this in two ways and compare the results.
First way : complementary set
Total number of four-digit numbers such that the leftmost digit is nonzero :
$$9\times 10^3 = 9000 $$
Numbers with pairwaise distint digits :
$$9\times 9 \times 8 \times 7 = 4536$$
So the number of those in which at least two digits are the same is
$$ 9000 - 4536 = 4464$$
Second way : bruteforce
number of numbers with all digits identical :
$$ 9$$
number of numbers with three identical digits :
$$4\times 9 \times 8 + 9 $$ (case containing $0$ and the other case)
number of numbers with two identical digits :
$$6\times 9 \times 8 \times 7 + 3 \times 9 \times 8 $$
We we sum this up we get
$$ 3546 $$
I don't see what is my mistake.
Thanks for your time.