The deadline kinda caughtup with me. Was working on 157 code - but since I posted after deadline doesn't count:

 Code:
Function a($,$c)

 dim $i,$j

 $= split($)
 $i = -1

 while 1

  $i = ($i + 1) * ($i < ubound($))

  for $j = $[$i] to 8
   if ascan($,$j+1) > -1
    $j = 9
   endif
  next

  if $j = 9
   $[$i] = 0
   $a = $a + 1
   if $i = $c
    return
;  endif
; endif
;loop

EndFunction