Define count-leaf
Define subst
Define permutation
Define permutation-n