for a=0 to 1000000
   subtotal=0
   for n=1 to len(str$(a))
      if ( val( mid$(str$(a),n-1) ) - val( mid$(str$(a),n) ) ) <= 0 then inc subtotal else exit
   next n
   if subtotal = len(str$(a)) then inc total
next a
print total
wait key