There are 271 numbers between 1 and 1000 that have atleast one 8 in them. Similarly, there are 271 numbers between 1 and 1000 that have at least one 9 in them. If you count the duplicate 8's and 9's, then there are 300 numbers between 1 and 1000 with 8 and 9 in them.