#!/bin/sh
#|
exec csi -s "$0" "$@"
|#
(require-extension (only srfi-1 remove iota))
(import (chicken process-context)
(chicken format))
(define (Func num max)
(let ((base (+ 1 (* (quotient num 10) 10))))
(length
(remove (lambda (x)
(> (* x (modulo x 10)) max))
(iota 9 base)))))
(define (main args)
(handle-exceptions exn
(begin
(display "bad argument count")
(newline))
(format #t "N = ~a~%" (apply Func (map string->number args))))
0)
(cond-expand
(chicken-script
(main (command-line-arguments)))
(else))
IyEvYmluL3NoCiN8CmV4ZWMgY3NpIC1zICIkMCIgIiRAIgp8IwoKKHJlcXVpcmUtZXh0ZW5zaW9uIChvbmx5IHNyZmktMSByZW1vdmUgaW90YSkpCihpbXBvcnQgKGNoaWNrZW4gcHJvY2Vzcy1jb250ZXh0KQogICAgICAgIChjaGlja2VuIGZvcm1hdCkpCgooZGVmaW5lIChGdW5jIG51bSBtYXgpCiAgKGxldCAoKGJhc2UgKCsgMSAoKiAocXVvdGllbnQgbnVtIDEwKSAxMCkpKSkKICAgIChsZW5ndGgKICAgICAocmVtb3ZlIChsYW1iZGEgKHgpCiAgICAgICAgICAgICAgICg+ICgqIHggKG1vZHVsbyB4IDEwKSkgbWF4KSkKICAgICAgICAgICAgIChpb3RhIDkgYmFzZSkpKSkpCgooZGVmaW5lIChtYWluIGFyZ3MpCiAgKGhhbmRsZS1leGNlcHRpb25zIGV4bgogICAgICAoYmVnaW4KICAgICAgICAoZGlzcGxheSAiYmFkIGFyZ3VtZW50IGNvdW50IikKICAgICAgICAobmV3bGluZSkpCiAgICAoZm9ybWF0ICN0ICJOID0gfmF+JSIgKGFwcGx5IEZ1bmMgKG1hcCBzdHJpbmctPm51bWJlciBhcmdzKSkpKQogIDApCgooY29uZC1leHBhbmQKICAoY2hpY2tlbi1zY3JpcHQKICAgKG1haW4gKGNvbW1hbmQtbGluZS1hcmd1bWVudHMpKSkKICAoZWxzZSkpCg==