for x=1 to 1000000
   for y=2 to len(str$(x))
      if (mid$(str$(x),y-1)>mid$(str$(x),y)) then exit else if y=len(str$(x)) then inc numbers
   next y
   if len(str$(x))=1 then inc numbers
next x
print numbers
wait key