counting permutation number