i=n=0 exec"f=1\nwhile i:f|=i%3;i/=3\nif f<2:print n\ni=n=n+1;"*1000