Finding the number of permutations using a formula