Try to look at all the possible numbers between 1000 and 8999, that don't contain a 5.
First digit can be either 1,2,3,4,6,7,8,9 - that's 8 numbers. The second digit can 0,1,2,3,4,6,7,8,9 - 9 numbers, same for 3rd and 4th digit. So all the possibilities are 8*9*9*9