2017 AIME II Problem 4

Find the number of positive integers less than or equal to 2017 whose base-three representation contains no digit equal to 0 .