from 1 to 1000:
2^0, 2^1, ..., 2^9 (10 numbers)
3^0, 3^1, ..., 3^6 (7 numbers)
2^0 = 3^0 = 1 was counted twice, so 16 numbers from 1 to 1000
from 1/1000 to 1:
1/2^9, 1/2^8, ..., 1/2 (9 numbers)
1/3^6, 1/3^5, ..., 1/3 (6 numbers)
Therre are 15 numbers from 1/1000 to 1.
Overall, there are 31 numbers.