TITLE: Find the number of times $5$ will be written while listing integers from $1$ to $1000$
QUESTION [5 upvotes]: Just a question and then, I'll come up with my doubt. It will be easier to explain then.

Question: Find the number of times $5$ will be written while listing integers from $1$ to $1000$.

Now, it can be solved in this fashion. The numbers will be of the form: $5xy, x5y, xy5$ where $x,y$ denote the two other digits such that $0\leq x,y \leq 9$. So, $x,y$ can take $10$ choice each. So, answer is $10^2$ multiplied by $3$ for the $3$ sets of numbers mentioned. Answer becomes $300$ and it's correct.
But the thing is: When we are considering $x5y$, we include $557$ in this. Again, we include $557$ while considering $5xy$, right? 
So that's a double count, yet the answer is right? This way I think there'll be a lot of more-than 1 counts, I'm not sure. 
Please explain me. Regards

REPLY [5 votes]: From $0$ to $999$ there are $1000$ numbers and they have $10\times 1+90\times 2+900\times 3=2890$ digits
$190$ are zeros and the other $2700$ are divided equally between the other digits, so there are $300$ fives as $300$ nines etc